public class DefaultSecurityLogic<R,C extends WebContext> extends AbstractExceptionAwareLogic<R,C> implements SecurityLogic<R,C>
Default security logic:
If the HTTP request matches the matchers configuration (or no matchers are defined),
the security is applied. Otherwise, the user is automatically granted access.
First, if the user is not authenticated (no profile) and if some clients have been defined in the clients parameter,
a login is tried for the direct clients.
Then, if the user has profile, authorizations are checked according to the authorizers configuration.
If the authorizations are valid, the user is granted access. Otherwise, a 403 error page is displayed.
Finally, if the user is still not authenticated (no profile), he is redirected to the appropriate identity provider
if the first defined client is an indirect one in the clients configuration. Otherwise, a 401 error page is displayed.
logger| Constructor and Description |
|---|
DefaultSecurityLogic() |
| Modifier and Type | Method and Description |
|---|---|
protected HttpAction |
forbidden(C context,
java.util.List<Client> currentClients,
java.util.List<CommonProfile> profiles,
java.lang.String authorizers)
Return a forbidden error.
|
AjaxRequestResolver |
getAjaxRequestResolver() |
AuthorizationChecker |
getAuthorizationChecker() |
ClientFinder |
getClientFinder() |
MatchingChecker |
getMatchingChecker() |
ProfileStorageDecision |
getProfileStorageDecision() |
R |
perform(C context,
Config config,
SecurityGrantedAccessAdapter<R,C> securityGrantedAccessAdapter,
HttpActionAdapter<R,C> httpActionAdapter,
java.lang.String clients,
java.lang.String authorizers,
java.lang.String matchers,
java.lang.Boolean inputMultiProfile,
java.lang.Object... parameters)
Perform the security logic.
|
protected HttpAction |
redirectToIdentityProvider(C context,
java.util.List<Client> currentClients)
Perform a redirection to start the login process of the first indirect client.
|
protected void |
saveRequestedUrl(C context,
java.util.List<Client> currentClients)
Save the requested url.
|
void |
setAjaxRequestResolver(AjaxRequestResolver ajaxRequestResolver) |
void |
setAuthorizationChecker(AuthorizationChecker authorizationChecker) |
void |
setClientFinder(ClientFinder clientFinder) |
void |
setMatchingChecker(MatchingChecker matchingChecker) |
void |
setProfileStorageDecision(ProfileStorageDecision profileStorageDecision) |
protected boolean |
startAuthentication(C context,
java.util.List<Client> currentClients)
Return whether we must start a login process if the first client is an indirect one.
|
java.lang.String |
toString() |
protected HttpAction |
unauthorized(C context,
java.util.List<Client> currentClients)
Return an unauthorized error.
|
getErrorUrl, handleException, runtimeException, setErrorUrlgetProfileManager, getProfileManagerFactory, setProfileManagerFactorypublic R perform(C context, Config config, SecurityGrantedAccessAdapter<R,C> securityGrantedAccessAdapter, HttpActionAdapter<R,C> httpActionAdapter, java.lang.String clients, java.lang.String authorizers, java.lang.String matchers, java.lang.Boolean inputMultiProfile, java.lang.Object... parameters)
SecurityLogicperform in interface SecurityLogic<R,C extends WebContext>context - the web contextconfig - the configurationsecurityGrantedAccessAdapter - the success adapterhttpActionAdapter - the HTTP action adapterclients - the defined clientsauthorizers - the defined authorizersmatchers - the defined matchersinputMultiProfile - whether multi profiles are supportedparameters - additional parametersprotected HttpAction forbidden(C context, java.util.List<Client> currentClients, java.util.List<CommonProfile> profiles, java.lang.String authorizers)
context - the web contextcurrentClients - the current clientsprofiles - the current profilesauthorizers - the authorizersprotected boolean startAuthentication(C context, java.util.List<Client> currentClients)
context - the web contextcurrentClients - the current clientsprotected void saveRequestedUrl(C context, java.util.List<Client> currentClients)
context - the web contextcurrentClients - the current clientsprotected HttpAction redirectToIdentityProvider(C context, java.util.List<Client> currentClients)
context - the web contextcurrentClients - the current clientsprotected HttpAction unauthorized(C context, java.util.List<Client> currentClients)
context - the web contextcurrentClients - the current clientspublic ClientFinder getClientFinder()
public void setClientFinder(ClientFinder clientFinder)
public AuthorizationChecker getAuthorizationChecker()
public void setAuthorizationChecker(AuthorizationChecker authorizationChecker)
public MatchingChecker getMatchingChecker()
public void setMatchingChecker(MatchingChecker matchingChecker)
public ProfileStorageDecision getProfileStorageDecision()
public void setProfileStorageDecision(ProfileStorageDecision profileStorageDecision)
public AjaxRequestResolver getAjaxRequestResolver()
public void setAjaxRequestResolver(AjaxRequestResolver ajaxRequestResolver)
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2019. All Rights Reserved.