jeremyschulman / netbox-plugin-auth-saml2

Netbox plugin for SSO using SAML2
119 stars 23 forks source link

User Configuration not working #5

Closed log1cb0mb closed 4 years ago

log1cb0mb commented 4 years ago

Python 3.6.8 django3-auth-saml2 0.2.0 netbox-plugin-auth-saml2 0.2 NetBox 2.8.6

Configurations in place:

# Remote authentication support
REMOTE_AUTH_ENABLED = True
REMOTE_AUTH_BACKEND = 'utilities.auth_backends.RemoteUserBackend'
REMOTE_AUTH_HEADER = 'HTTP_REMOTE_USER'
REMOTE_AUTH_AUTO_CREATE_USER = True
REMOTE_AUTH_DEFAULT_GROUPS = ['application-netbox-admins']
#REMOTE_AUTH_DEFAULT_PERMISSIONS = []

PLUGINS_CONFIG = {
    'django3_saml2_nbplugin': {

        # Use the Netbox default remote backend
        'AUTHENTICATION_BACKEND': REMOTE_AUTH_BACKEND,

        # Custom URL to validate incoming SAML requests against
        'ASSERTION_URL': 'https://netboxokta.com',

        # Populates the Issuer element in authn reques
        'ENTITY_ID': 'https://netboxokta.com/',

        # Metadata is required, choose either remote url or local file path
        'METADATA_AUTO_CONF_URL': "https://mycorp.okta.com/app/1234567890/sso/saml/metadata"

    }
}

User is able to authenticate and user login in NetBoX reflects to email/OKTA NAMEID but the function: def configure_user(self, request: WSGIRequest, user: User) -> User: does not seem to be doing anything. First, last Name and email fields in user profile are empty. Any ideas what is missing and how to troubleshoot this?

log1cb0mb commented 4 years ago

My bad! I figured out why that function was not being called because i was default utilities.auth_backends.RemoteUserBackend instead of the plugin backend - sublass django3_saml2_nbplugin.backends.SAML2AttrUserBackend.

Now the user profile parameters are working!