summaryrefslogtreecommitdiffstats
path: root/django/sp_sso/sp_sso/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/sp_sso/sp_sso/views.py')
-rw-r--r--django/sp_sso/sp_sso/views.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/django/sp_sso/sp_sso/views.py b/django/sp_sso/sp_sso/views.py
index e87aea8..3448150 100644
--- a/django/sp_sso/sp_sso/views.py
+++ b/django/sp_sso/sp_sso/views.py
@@ -20,6 +20,7 @@ logger = logging.getLogger('sp_sso.resource')
@csrf_exempt
def index(request):
+ """Main view for the service provider"""
if request.method != 'GET':
return HttpResponse('Bad method.', status=405)
request.session['tracking_code'] = request.GET.get('tracking_code')
@@ -27,6 +28,7 @@ def index(request):
return render(request, 'index.html', locals())
def login(request, *args, **kwargs):
+ """Defers the login scheme to the identity provider thanks to mellon"""
if any(get_idps()):
if not 'next' in request.GET:
return HttpResponseRedirect(resolve_url('mellon_login'))
@@ -35,6 +37,7 @@ def login(request, *args, **kwargs):
return auth_views.login(request, *args, **kwargs)
def logout(request, next_page=None):
+ """Defers the logout scheme to the identity provider thanks to mellon"""
if any(get_idps()):
return HttpResponseRedirect(resolve_url('mellon_logout'))
auth_logout(request)
@@ -42,10 +45,24 @@ def logout(request, next_page=None):
return HttpResponseRedirect(next_page)
def subscribed(request):
+ """Success view for the self-subscription process"""
logger.info(u'Processing request %s', request)
return render_message(request, _("Subscribed."))
class Declare(FormView):
+ """Self-subscription FormView
+
+ Users allowed to self-subscribe to the Campus MUSTN'T be registered to the
+ Campus LDAP directory yet. (Presence checking is performed against their
+ eduPersonPrincipalName).
+
+ Additionnally, their institution (supannEtablissement) or research unit
+ (supannEntiteAffectation) MUST be declared in the Campus database.
+
+ These restrictions are processed thanks to the `user_can_declare`
+ decorator.
+
+ """
form_class = RegistrationForm
template_name = 'declare_form.html'
success_url = '/declare/subscribed/'