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 Summary
Fields Modifier and Type Field Description protected static StringPRINCIPAL_SESSION_NAMEprotected static StringTOKEN_CACHE_SESSION_ATTRIBUTE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticationResult<com.microsoft.aad.msal4j.IAuthenticationResult>doHandleCallback(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handle the callback request after login on the ssoio.vertigo.core.lang.Tuple<AuthenticationResult<com.microsoft.aad.msal4j.IAuthenticationResult>,javax.servlet.http.HttpServletRequest>doInterceptRequest(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)booleandoLogout(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)voiddoRedirectToSso(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handle the redirect to the sso login pagestatic com.microsoft.aad.msal4j.IAuthenticationResultgetAuthSessionObject(javax.servlet.http.HttpServletRequest request)StringgetCallbackUrl()Returns the url for callbackOptional<String>getExternalUrlOptional()Return an optional external url of the application (if it is behind a firewall or a proxy)StringgetLogoutUrl()Returns the url for logoutOptional<String>getRequestedUri(javax.servlet.http.HttpServletRequest httpRequest)Return the original request a user wanted before beeing redirected to the ssoStringgetUrlHandlerPrefix()Url prefix of request directly handled by the pluginMap<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 pluginStringgetUrlPrefix()Url prefix of urls that are protected with this authentication plugin
-
-
-
Field Detail
-
PRINCIPAL_SESSION_NAME
protected static final String PRINCIPAL_SESSION_NAME
- See Also:
- Constant Field Values
-
TOKEN_CACHE_SESSION_ATTRIBUTE
protected static final String TOKEN_CACHE_SESSION_ATTRIBUTE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getUrlPrefix
public String getUrlPrefix()
Url prefix of urls that are protected with this authentication plugin- Specified by:
getUrlPrefixin interfaceWebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>- Returns:
- the prefix
-
getUrlHandlerPrefix
public String getUrlHandlerPrefix()
Url prefix of request directly handled by the plugin- Specified by:
getUrlHandlerPrefixin interfaceWebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>- Returns:
- the prefix
-
getCallbackUrl
public String getCallbackUrl()
Returns the url for callback- Specified by:
getCallbackUrlin interfaceWebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>- Returns:
- url for callback
-
getLogoutUrl
public String getLogoutUrl()
Returns the url for logout- Specified by:
getLogoutUrlin interfaceWebAuthenticationPlugin<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:
getExternalUrlOptionalin interfaceWebAuthenticationPlugin<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>,javax.servlet.http.HttpServletRequest> doInterceptRequest(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)
- Specified by:
doInterceptRequestin interfaceWebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
-
doHandleCallback
public AuthenticationResult<com.microsoft.aad.msal4j.IAuthenticationResult> doHandleCallback(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:WebAuthenticationPluginHandle the callback request after login on the sso- Specified by:
doHandleCallbackin interfaceWebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>- Parameters:
request- the requestresponse- the response to consume- Returns:
- result of login challenge, providing info of the logged in user
-
doRedirectToSso
public void doRedirectToSso(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Description copied from interface:WebAuthenticationPluginHandle the redirect to the sso login page- Specified by:
doRedirectToSsoin interfaceWebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>- Parameters:
request- the requestresponse- the response to consume
-
getAuthSessionObject
public static com.microsoft.aad.msal4j.IAuthenticationResult getAuthSessionObject(javax.servlet.http.HttpServletRequest request)
-
getUrlHandlers
public Map<String,BiFunction<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,io.vertigo.core.lang.Tuple<Boolean,javax.servlet.http.HttpServletRequest>>> getUrlHandlers()
Description copied from interface:WebAuthenticationPluginRegister additionnal handler for specific request necessary for the plugin- Specified by:
getUrlHandlersin interfaceWebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>- Returns:
- le map of specific handlers
-
getRequestedUri
public Optional<String> getRequestedUri(javax.servlet.http.HttpServletRequest httpRequest)
Description copied from interface:WebAuthenticationPluginReturn the original request a user wanted before beeing redirected to the sso- Specified by:
getRequestedUriin interfaceWebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>- Parameters:
httpRequest- the request- Returns:
- the uri
-
doLogout
public boolean doLogout(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse)- Specified by:
doLogoutin interfaceWebAuthenticationPlugin<com.microsoft.aad.msal4j.IAuthenticationResult>
-
-