Class OIDCWebAuthenticationPlugin

  • All Implemented Interfaces:
    io.vertigo.core.node.component.CoreComponent, io.vertigo.core.node.component.Plugin, WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>

    public class OIDCWebAuthenticationPlugin
    extends Object
    implements WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
    Base authentication handler for OpenId Connect.
    Author:
    skerdudou
    • Constructor Detail

      • OIDCWebAuthenticationPlugin

        @Inject
        public OIDCWebAuthenticationPlugin​(Optional<String> urlPrefixOpt,
                                           Optional<String> urlHandlerPrefixOpt,
                                           Optional<String> connectorNameOpt,
                                           List<io.vertigo.connectors.oidc.OIDCDeploymentConnector> oidcDeploymentConnectors)
    • Method Detail

      • getUrlHandlers

        public Map<String,​BiFunction<javax.servlet.http.HttpServletRequest,​javax.servlet.http.HttpServletResponse,​io.vertigo.core.lang.Tuple<Boolean,​javax.servlet.http.HttpServletRequest>>> getUrlHandlers()
        Register additionnal handler for specific request necessary for the plugin
        Specified by:
        getUrlHandlers in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
        Returns:
        le map of specific handlers
      • getUrlPrefix

        public String getUrlPrefix()
        Url prefix of urls that are protected with this authentication plugin
        Specified by:
        getUrlPrefix in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
        Returns:
        the prefix
      • getUrlHandlerPrefix

        public String getUrlHandlerPrefix()
        Url prefix of request directly handled by the plugin
        Specified by:
        getUrlHandlerPrefix in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
        Returns:
        the prefix
      • getCallbackUrl

        public String getCallbackUrl()
        Returns the url for callback
        Specified by:
        getCallbackUrl in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
        Returns:
        url for callback
      • getLogoutUrl

        public String getLogoutUrl()
        Returns the url for logout
        Specified by:
        getLogoutUrl in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
        Returns:
        url for logout
      • getExternalUrlOptional

        public Optional<String> getExternalUrlOptional()
        Return an optional external url of the application (if it is behind a firewall or a proxy)
        Specified by:
        getExternalUrlOptional in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
        Returns:
        the external url of the app : as seen by the end user
      • getRequestedUri

        public Optional<String> getRequestedUri​(javax.servlet.http.HttpServletRequest httpRequest)
        Return the original request a user wanted before beeing redirected to the sso
        Specified by:
        getRequestedUri in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
        Parameters:
        httpRequest - the request
        Returns:
        the uri
      • doHandleCallback

        public AuthenticationResult<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse> doHandleCallback​(javax.servlet.http.HttpServletRequest httpRequest,
                                                                                                           javax.servlet.http.HttpServletResponse httpResponse)
        Handle the callback request after login on the sso
        Specified by:
        doHandleCallback in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
        Parameters:
        httpRequest - the request
        httpResponse - the response to consume
        Returns:
        result of login challenge, providing info of the logged in user
      • doRedirectToSso

        public void doRedirectToSso​(javax.servlet.http.HttpServletRequest httpRequest,
                                    javax.servlet.http.HttpServletResponse httpResponse)
        Handle the redirect to the sso login page
        Specified by:
        doRedirectToSso in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>
        Parameters:
        httpRequest - the request
        httpResponse - the response to consume
      • doLogout

        public boolean doLogout​(javax.servlet.http.HttpServletRequest httpRequest,
                                javax.servlet.http.HttpServletResponse httpResponse)
        Specified by:
        doLogout in interface WebAuthenticationPlugin<com.nimbusds.oauth2.sdk.AuthorizationSuccessResponse>