(request, idp_slug)
return HttpResponseRedirect(login_url)
This view initiates a SAML 2.0 login request with the Identity Provider.
This view initiates a SAML 2.0 login request with the Identity Provider.
This view initiates a SAML 2 . 0 login request with the Identity Provider .
def sso_saml_login(request, idp_slug):
    """
    This view initiates a SAML 2.0 login request with the Identity Provider.
    """
    login_url = request.saml2_auth.login(return_to=request.GET.get('next'))
    username = request.GET.get('username')
    if username:
        # verify that the stored user data actually the current IdP
        idp = IdentityProvider.get_active_identity_provider_by_username(username)
        if idp and idp.slug == idp_slug:
            # pre-populate username for Azure AD
            login_url = f'{login_url}&login_hint={username}'
    return HttpResponseRedirect(login_url)
def sso_saml_login ( request , idp_slug ) : login_url = request . saml2_auth . login ( return_to = request . GET . get ( 'next' ) ) username = request . GET . get ( 'username' ) if username : # verify that the stored user data actually the current IdP idp = IdentityProvider . get_active_identity_provider_by_username ( username ) if idp and idp . slug == idp_slug : # pre-populate username for Azure AD login_url = f'{login_url}&login_hint={username}' return HttpResponseRedirect ( login_url )