Package org.opencastproject.security.jwt
Class DynamicLoginHandler
java.lang.Object
org.opencastproject.security.jwt.DynamicLoginHandler
- All Implemented Interfaces:
JWTLoginHandler,org.springframework.beans.factory.InitializingBean
public class DynamicLoginHandler
extends Object
implements org.springframework.beans.factory.InitializingBean, JWTLoginHandler
Dynamic login handler for JWTs.
-
Field Summary
Fields inherited from interface org.opencastproject.security.jwt.JWTLoginHandler
MECH_JWT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidexistingUserLogin(String username, com.auth0.jwt.interfaces.DecodedJWT jwt) Handles an existing user login.handleToken(String token) Takes a JWT string, decodes it, validates it and returns the username encoded in the JWT.voidnewUserLogin(String username, com.auth0.jwt.interfaces.DecodedJWT jwt) Handles a new user login.voidsetClaimConstraints(List<String> claimConstraints) Setter for the claim constraints.voidsetEmailMapping(String emailMapping) Setter for the email mapping.voidsetExpectedAlgorithms(List<String> expectedAlgorithms) Setter for the expected algorithms.voidsetJwksCacheExpiresIn(int jwksCacheExpiresIn) Setter for the JWKS cache expiration.voidsetJwksUrl(String jwksUrl) Setter for the JWKS URL.voidsetJwtCacheExpiresIn(int jwtCacheExpiresIn) Setter for the JWT cache expiration.voidsetJwtCacheSize(int jwtCacheSize) Setter for the JWT cache size.voidsetNameMapping(String nameMapping) Setter for the name mapping.voidsetRoleMappings(List<String> roleMappings) Setter for the role mappings.voidSetter for the secret used for JWT validation.voidsetSecurityService(SecurityService securityService) Setter for the security service.voidsetUserDetailsService(org.springframework.security.core.userdetails.UserDetailsService userDetailsService) Setter for the user details service.voidsetUserDirectoryService(UserDirectoryService userDirectoryService) Setter for the user directory service.voidsetUsernameMapping(String usernameMapping) Setter for the username mapping.voidsetUserReferenceProvider(UserReferenceProvider userReferenceProvider) Setter for the user reference provider.
-
Constructor Details
-
DynamicLoginHandler
public DynamicLoginHandler()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
handleToken
Description copied from interface:JWTLoginHandlerTakes a JWT string, decodes it, validates it and returns the username encoded in the JWT.- Specified by:
handleTokenin interfaceJWTLoginHandler- Parameters:
token- The JWT string.- Returns:
- The username or
nullif the validation failed.
-
newUserLogin
Handles a new user login.- Parameters:
username- The username.jwt- The decoded JWT.
-
existingUserLogin
Handles an existing user login.- Parameters:
username- The username.jwt- The decoded JWT.
-
setUserDetailsService
public void setUserDetailsService(org.springframework.security.core.userdetails.UserDetailsService userDetailsService) Setter for the user details service.- Parameters:
userDetailsService- The user details service.
-
setUserDirectoryService
Setter for the user directory service.- Parameters:
userDirectoryService- The user directory service.
-
setSecurityService
Setter for the security service.- Parameters:
securityService- The security service.
-
setUserReferenceProvider
Setter for the user reference provider.- Parameters:
userReferenceProvider- The user reference provider.
-
setJwksUrl
Setter for the JWKS URL.- Parameters:
jwksUrl- The JWKS URL.
-
setJwksCacheExpiresIn
public void setJwksCacheExpiresIn(int jwksCacheExpiresIn) Setter for the JWKS cache expiration.- Parameters:
jwksCacheExpiresIn- The number of minutes after which a cached JWKS expires.
-
setSecret
Setter for the secret used for JWT validation.- Parameters:
secret- The secret.
-
setExpectedAlgorithms
Setter for the expected algorithms.- Parameters:
expectedAlgorithms- The expected algorithms.
-
setClaimConstraints
Setter for the claim constraints.- Parameters:
claimConstraints- The claim constraints.
-
setUsernameMapping
Setter for the username mapping.- Parameters:
usernameMapping- The username mapping.
-
setNameMapping
Setter for the name mapping.- Parameters:
nameMapping- The name mapping.
-
setEmailMapping
Setter for the email mapping.- Parameters:
emailMapping- The email mapping.
-
setRoleMappings
Setter for the role mappings.- Parameters:
roleMappings- The role mappings.
-
setJwtCacheSize
public void setJwtCacheSize(int jwtCacheSize) Setter for the JWT cache size.- Parameters:
jwtCacheSize- The JWT cache size.
-
setJwtCacheExpiresIn
public void setJwtCacheExpiresIn(int jwtCacheExpiresIn) Setter for the JWT cache expiration.- Parameters:
jwtCacheExpiresIn- The number of minutes after which a cached JWT expires.
-