Class AADCredentialProvider
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.authentication.AbstractCredentialProvider
-
- org.ametys.plugins.extrausermgt.authentication.aad.AADCredentialProvider
-
- All Implemented Interfaces:
BlockingCredentialProvider,CredentialProvider,LogEnabled,Component,Contextualizable,Serviceable
public class AADCredentialProvider extends AbstractCredentialProvider implements BlockingCredentialProvider, Contextualizable, Serviceable
Sign in through Azure AD, using the OpenId Connect protocol.
-
-
Field Summary
Fields Modifier and Type Field Description static StringREDIRECT_URI_SESSION_ATTRIBUTESession attribute for the redirect URIstatic StringTOKEN_SESSION_ATTRIBUTESession attribute for Azure AD token
-
Constructor Summary
Constructors Constructor Description AADCredentialProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UserIdentityblockingGetUserIdentity(Redirector redirector)Method called by AuthenticateAction each time a request need authentication.booleanblockingGrantAnonymousRequest()Method called by AuthenticateAction before asking for credentials.booleanblockingIsStillConnected(UserIdentity userIdentity, Redirector redirector)Validates that the user specify is still connectedvoidblockingUserAllowed(UserIdentity userIdentity, Redirector redirector)Method called by AuthenticateAction after authentication process succeededvoidblockingUserNotAllowed(Redirector redirector)Method called by AuthenticateAction each a user could not get authenticated.voidcontextualize(Context context)voidinit(String id, String cpModelId, Map<String,Object> paramValues, String label)Initialize the credential provider with given parameters' values.booleanrequiresNewWindow()Does this blocking credential provider requires a new window to process.voidservice(ServiceManager manager)-
Methods inherited from class org.ametys.core.authentication.AbstractCredentialProvider
equals, getCredentialProviderModelId, getId, getLabel, getParameterValues, hashCode
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.core.authentication.CredentialProvider
getCredentialProviderModelId, getId, getLabel, getParameterValues, getUserIdentity, grantAnonymousRequest, isStillConnected, userAllowed, userNotAllowed
-
-
-
-
Field Detail
-
TOKEN_SESSION_ATTRIBUTE
public static final String TOKEN_SESSION_ATTRIBUTE
Session attribute for Azure AD token- See Also:
- Constant Field Values
-
REDIRECT_URI_SESSION_ATTRIBUTE
public static final String REDIRECT_URI_SESSION_ATTRIBUTE
Session attribute for the redirect URI- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AADCredentialProvider
public AADCredentialProvider()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
init
public void init(String id, String cpModelId, Map<String,Object> paramValues, String label)
Description copied from interface:CredentialProviderInitialize the credential provider with given parameters' values.- Specified by:
initin interfaceCredentialProvider- Overrides:
initin classAbstractCredentialProvider- Parameters:
id- The unique identifiercpModelId- The id of credential provider extension pointparamValues- The parameters' valueslabel- The specific label of this instance. Can be null
-
blockingIsStillConnected
public boolean blockingIsStillConnected(UserIdentity userIdentity, Redirector redirector) throws Exception
Description copied from interface:BlockingCredentialProviderValidates that the user specify is still connected- Specified by:
blockingIsStillConnectedin interfaceBlockingCredentialProvider- Parameters:
userIdentity- the user previously correctly identified with this credential providerredirector- The cocoon redirector- Returns:
- true if this CredentialProvider was in a valid state, false to restart authentication process
- Throws:
Exception- If an error occurred
-
blockingGrantAnonymousRequest
public boolean blockingGrantAnonymousRequest()
Description copied from interface:BlockingCredentialProviderMethod called by AuthenticateAction before asking for credentials. This method is used to bypass authentication. If this method returns true, no authentication will be required. Use it with care, as it may lead to obvious security issues.- Specified by:
blockingGrantAnonymousRequestin interfaceBlockingCredentialProvider- Returns:
- true if the Request is not authenticated
-
blockingGetUserIdentity
public UserIdentity blockingGetUserIdentity(Redirector redirector) throws Exception
Description copied from interface:BlockingCredentialProviderMethod called by AuthenticateAction each time a request need authentication.- Specified by:
blockingGetUserIdentityin interfaceBlockingCredentialProvider- Parameters:
redirector- the cocoon redirector.- Returns:
- the
UserIdentitycorresponding to the user (with or without population specified), or null if user could not get authenticated. - Throws:
Exception- if something wrong occurs
-
blockingUserNotAllowed
public void blockingUserNotAllowed(Redirector redirector)
Description copied from interface:BlockingCredentialProviderMethod called by AuthenticateAction each a user could not get authenticated. This method implementation is responsible of redirecting response to appropriate url.- Specified by:
blockingUserNotAllowedin interfaceBlockingCredentialProvider- Parameters:
redirector- the cocoon Redirector that can be used for redirecting response.
-
blockingUserAllowed
public void blockingUserAllowed(UserIdentity userIdentity, Redirector redirector) throws ProcessingException, IOException
Description copied from interface:BlockingCredentialProviderMethod called by AuthenticateAction after authentication process succeeded- Specified by:
blockingUserAllowedin interfaceBlockingCredentialProvider- Parameters:
userIdentity- The user correctly connectedredirector- the cocoon Redirector that can be used for redirecting response.- Throws:
ProcessingExceptionIOException
-
requiresNewWindow
public boolean requiresNewWindow()
Description copied from interface:BlockingCredentialProviderDoes this blocking credential provider requires a new window to process.- Specified by:
requiresNewWindowin interfaceBlockingCredentialProvider- Returns:
- true to ask the client to process this credential provider throught a new window
-
-