Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from django.urls import path
from . import views
urlpatterns = [
path('login/', views.login, name='saml2_login'),
path('acs/', views.AssertionConsumerServiceView.as_view(), name='saml2_acs'),
path('logout/', views.logout, name='saml2_logout'),
path('ls/', views.logout_service, name='saml2_ls'),
path('ls/post/', views.logout_service_post, name='saml2_ls_post'),
path('metadata/', views.metadata, name='saml2_metadata'),
]
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import django
from django.conf.urls import handler500, url
from djangosaml2 import views
urlpatterns = [
url(r'^login/$', views.login, name='saml2_login'),
url(r'^acs/$', views.assertion_consumer_service, name='saml2_acs'),
url(r'^logout/$', views.logout, name='saml2_logout'),
url(r'^ls/$', views.logout_service, name='saml2_ls'),
url(r'^ls/post/$', views.logout_service_post, name='saml2_ls_post'),
url(r'^metadata/$', views.metadata, name='saml2_metadata'),
]
if django.VERSION < (1, 8):
# django.conf.urls.patterns will be removed from django 1.10, so we
# import it here
from django.conf.urls import patterns
urlpatterns = patterns('', *urlpatterns)
handler500 = handler500
__all__ = ['login', 'echo_attributes', 'assertion_consumer_service', 'metadata']
if logout_service_post is None:
_assertion_consumer_service = assertion_consumer_service
@require_POST
@csrf_exempt
def assertion_consumer_service(request, config_loader_path=None, attribute_mapping=None, create_unknown_user=None):
username_source = libsaml.conf.USERNAME_SOURCE.get().lower()
return _assertion_consumer_service(request, config_loader_path, attribute_mapping, create_unknown_user, username_source)
setattr(logout_service, 'login_notrequired', True)
setattr(login, 'login_notrequired', True)
setattr(echo_attributes, 'login_notrequired', True)
setattr(assertion_consumer_service, 'login_notrequired', True)
setattr(metadata, 'login_notrequired', True)
if logout_service_post is not None:
setattr(logout_service_post, 'login_notrequired', True)
def merengue_logout_service(request):
"""Do the logout and then send a message to the user"""
response = logout_service(request, config_loader_path='plugins.saml2.saml_config_loader.merengue_config_loader',
next_page='/')
if 'SAMLResponse' in request.GET: # we started the logout
send_info(request, _('Thank you for your visit'))
return response