Class 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.
    • Constructor Detail

      • DynamicLoginHandler

        public DynamicLoginHandler()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      • handleToken

        public String handleToken​(String token)
        Description copied from interface: JWTLoginHandler
        Takes a JWT string, decodes it, validates it and returns the username encoded in the JWT.
        Specified by:
        handleToken in interface JWTLoginHandler
        Parameters:
        token - The JWT string.
        Returns:
        The username or null if 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.