Class AzureAdWebAuthenticationPlugin

java.lang.Object
io.vertigo.vega.plugins.authentication.aad.AzureAdWebAuthenticationPlugin
All Implemented Interfaces:
io.vertigo.core.node.component.CoreComponent, io.vertigo.core.node.component.Plugin, WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>

public class AzureAdWebAuthenticationPlugin extends Object implements WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
  • Field Details

  • Constructor Details

    • AzureAdWebAuthenticationPlugin

      @Inject public AzureAdWebAuthenticationPlugin(Optional<String> urlPrefixOpt, Optional<String> urlHandlerPrefixOpt, Optional<String> connectorNameOpt, List<io.vertigo.connectors.azure.aad.AzureAdConnector> azureAdConnectors)
  • Method Details

    • getUrlPrefix

      public String getUrlPrefix()
      Url prefix of urls that are protected with this authentication plugin
      Specified by:
      getUrlPrefix in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
      Returns:
      the prefix
    • getUrlHandlerPrefix

      public String getUrlHandlerPrefix()
      Url prefix of request directly handled by the plugin
      Specified by:
      getUrlHandlerPrefix in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
      Returns:
      the prefix
    • getCallbackUrl

      public String getCallbackUrl()
      Returns the url for callback
      Specified by:
      getCallbackUrl in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
      Returns:
      url for callback
    • getLogoutUrl

      public String getLogoutUrl()
      Returns the url for logout
      Specified by:
      getLogoutUrl in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
      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.microsoft.aad.msal4j.IAuthenticationResult>
      Returns:
      the external url of the app : as seen by the end user
    • doInterceptRequest

      public io.vertigo.core.lang.Tuple<AuthenticationResult<com.microsoft.aad.msal4j.IAuthenticationResult>,jakarta.servlet.http.HttpServletRequest> doInterceptRequest(jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.servlet.http.HttpServletResponse httpResponse)
      Specified by:
      doInterceptRequest in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
    • doHandleCallback

      public AuthenticationResult<com.microsoft.aad.msal4j.IAuthenticationResult> doHandleCallback(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Description copied from interface: WebAuthenticationPlugin
      Handle the callback request after login on the sso
      Specified by:
      doHandleCallback in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
      Parameters:
      request - the request
      response - the response to consume
      Returns:
      result of login challenge, providing info of the logged in user
    • doRedirectToSso

      public void doRedirectToSso(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Description copied from interface: WebAuthenticationPlugin
      Handle the redirect to the sso login page
      Specified by:
      doRedirectToSso in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
      Parameters:
      request - the request
      response - the response to consume
    • getAuthSessionObject

      public static com.microsoft.aad.msal4j.IAuthenticationResult getAuthSessionObject(jakarta.servlet.http.HttpServletRequest request)
    • getUrlHandlers

      public Map<String,BiFunction<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse,io.vertigo.core.lang.Tuple<Boolean,jakarta.servlet.http.HttpServletRequest>>> getUrlHandlers()
      Description copied from interface: WebAuthenticationPlugin
      Register additionnal handler for specific request necessary for the plugin
      Specified by:
      getUrlHandlers in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
      Returns:
      le map of specific handlers
    • getRequestedUri

      public Optional<String> getRequestedUri(jakarta.servlet.http.HttpServletRequest httpRequest)
      Description copied from interface: WebAuthenticationPlugin
      Return the original request a user wanted before beeing redirected to the sso
      Specified by:
      getRequestedUri in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
      Parameters:
      httpRequest - the request
      Returns:
      the uri
    • doLogout

      public boolean doLogout(jakarta.servlet.http.HttpServletRequest httpRequest, jakarta.servlet.http.HttpServletResponse httpResponse)
      Specified by:
      doLogout in interface WebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>