def login_o365(request): extra_params = { 'scope': 'openid+profile', 'nonce': AuthService.get_random_string(), 'prompt': 'login' } o365_login_url = AuthService.get_authorization_url( request, 'code+id_token', 'Link/ProcessCode', AuthService.get_random_string(), extra_params) return HttpResponseRedirect(o365_login_url)
def o365_login(request): extra_params = {'nonce': AuthService.get_random_string()} o365_email = request.COOKIES.get(constant.o365_email_cookie) if o365_email: extra_params['login_hint'] = o365_email else: extra_params['prompt'] = 'login' o365_login_url = AuthService.get_authorization_url( request, 'code', 'Auth/O365/Callback', AuthService.get_random_string(), extra_params) settings.SESSION_EXPIRE_AT_BROWSER_CLOSE = True return HttpResponseRedirect(o365_login_url)
def consent(request): user = AuthService.get_current_user(request) extra_params = { 'scope': 'openid+profile', 'nonce': AuthService.get_random_string(), 'prompt': 'admin_consent' } if user.o365_user: extra_params['login_hint'] = user.o365_email o365_login_url = AuthService.get_authorization_url( request, 'code+id_token', 'Admin/ProcessCode', AuthService.get_random_string(), extra_params) return HttpResponseRedirect(o365_login_url)