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 Constructor Description DynamicLoginHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voidexistingUserLogin(String username, com.auth0.jwt.interfaces.DecodedJWT jwt)Handles an existing user login.StringhandleToken(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.voidsetSecret(String secret)Setter for the secret used for JWT validation.voidsetSecurityService(org.opencastproject.security.api.SecurityService securityService)Setter for the security service.voidsetUserDetailsService(org.springframework.security.core.userdetails.UserDetailsService userDetailsService)Setter for the user details service.voidsetUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService)Setter for the user directory service.voidsetUsernameMapping(String usernameMapping)Setter for the username mapping.voidsetUserReferenceProvider(org.opencastproject.userdirectory.api.UserReferenceProvider userReferenceProvider)Setter for the user reference provider.
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
handleToken
public String handleToken(String token)
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
public void newUserLogin(String username, com.auth0.jwt.interfaces.DecodedJWT jwt)
Handles a new user login.- Parameters:
username- The username.jwt- The decoded JWT.
-
existingUserLogin
public void existingUserLogin(String username, com.auth0.jwt.interfaces.DecodedJWT jwt)
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
public void setUserDirectoryService(org.opencastproject.security.api.UserDirectoryService userDirectoryService)
Setter for the user directory service.- Parameters:
userDirectoryService- The user directory service.
-
setSecurityService
public void setSecurityService(org.opencastproject.security.api.SecurityService securityService)
Setter for the security service.- Parameters:
securityService- The security service.
-
setUserReferenceProvider
public void setUserReferenceProvider(org.opencastproject.userdirectory.api.UserReferenceProvider userReferenceProvider)
Setter for the user reference provider.- Parameters:
userReferenceProvider- The user reference provider.
-
setJwksUrl
public void setJwksUrl(String jwksUrl)
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
public void setSecret(String secret)
Setter for the secret used for JWT validation.- Parameters:
secret- The secret.
-
setExpectedAlgorithms
public void setExpectedAlgorithms(List<String> expectedAlgorithms)
Setter for the expected algorithms.- Parameters:
expectedAlgorithms- The expected algorithms.
-
setClaimConstraints
public void setClaimConstraints(List<String> claimConstraints)
Setter for the claim constraints.- Parameters:
claimConstraints- The claim constraints.
-
setUsernameMapping
public void setUsernameMapping(String usernameMapping)
Setter for the username mapping.- Parameters:
usernameMapping- The username mapping.
-
setNameMapping
public void setNameMapping(String nameMapping)
Setter for the name mapping.- Parameters:
nameMapping- The name mapping.
-
setEmailMapping
public void setEmailMapping(String emailMapping)
Setter for the email mapping.- Parameters:
emailMapping- The email mapping.
-
setRoleMappings
public void setRoleMappings(List<String> roleMappings)
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.
-
-