Class TokenService

java.lang.Object
fr.paris.lutece.plugins.oauth2.service.TokenService

public final class TokenService extends Object
TokenService
  • Constructor Details

    • TokenService

      public TokenService(@Named("oauth2.client") AuthClientConf defaultClientConfig, @Named("oauth2.server") AuthServerConf defaultauthServerConfig)
      Constructs a TokenService
      Parameters:
      defaultClientConfig - default client config
      defaultauthServerConfig - default server config
  • Method Details

    • getToken

      public Token getToken(String strAuthorizationCode, javax.servlet.http.HttpSession session, JWTParser jWTParser, String strStoredNonce) throws IOException, fr.paris.lutece.util.httpaccess.HttpAccessException, TokenValidationException
      Retrieve a token using an authorization code
      Parameters:
      strAuthorizationCode - The authorization code
      session - The HTTP session
      Returns:
      The token
      Throws:
      IOException - if an error occurs
      fr.paris.lutece.util.httpaccess.HttpAccessException - if an error occurs
      TokenValidationException - If the token validation failed
    • getToken

      public Token getToken(String strRedirectUri, AuthClientConf clientConfig, AuthServerConf authServerConf, String strAuthorizationCode, javax.servlet.http.HttpSession session, JWTParser jWTParser, String strStoredNonce, String strCodeVerifier) throws IOException, fr.paris.lutece.util.httpaccess.HttpAccessException, TokenValidationException
      Retrieve a token using an authorization code
      Parameters:
      the - strRedirectUri
      strAuthorizationCode - The authorization code
      session - The HTTP session
      Returns:
      The token
      Throws:
      IOException - if an error occurs
      fr.paris.lutece.util.httpaccess.HttpAccessException - if an error occurs
      TokenValidationException - If the token validation failed
    • validateRefreshToken

      public boolean validateRefreshToken(String strRefreshToken)
      Validate refresh token
      Parameters:
      clientConfig - ClientConf
      authServerConf - AutConf
      strRefreshToken - refreshToken
      Returns:
      true if the refresh token is already good
    • validateRefreshToken

      public boolean validateRefreshToken(AuthClientConf clientConfig, AuthServerConf authServerConf, String strRefreshToken)
      Validate refresh token
      Parameters:
      clientConfig - ClientConf
      authServerConf - AutConf
      strRefreshToken - refreshToken
      Returns:
      true if the refresh token is already good
    • getTokenByRefreshToken

      public Token getTokenByRefreshToken(String strRefreshToken)
      Get new Token using refresh token
      Parameters:
      clientConfig - ClientConf
      authServerConf - AutConf
      strRefreshToken - refreshToken
      Returns:
      true if the refresh token is already good
    • getTokenByRefreshToken

      public Token getTokenByRefreshToken(AuthClientConf clientConfig, AuthServerConf authServerConf, String strRefreshToken)
      Get new Token using refresh token
      Parameters:
      clientConfig - ClientConf
      authServerConf - AutConf
      strRefreshToken - refreshToken
      Returns:
      true if the refresh token is already good
    • parse

      public Token parse(String strJson, AuthClientConf clientConfig, AuthServerConf serverConfig, JWTParser jwtParser, String strStoredNonce) throws IOException, TokenValidationException
      parse the JSON for a token
      Parameters:
      strJson - The JSON
      clientConfig - The client configuration
      serverConfig - The server configuration
      strStoredNonce - The stored nonce
      Returns:
      The Token
      Throws:
      IOException - if an error occurs
      TokenValidationException - If the token validation failed
    • parse

      public Token parse(String strJson, Instant creationTime, AuthClientConf clientConfig, AuthServerConf serverConfig, JWTParser jwtParser, String strStoredNonce) throws IOException, TokenValidationException
      parse the JSON for a token
      Parameters:
      strJson - The JSON
      creationTime - The creation time of the token
      clientConfig - The client configuration
      serverConfig - The server configuration
      strStoredNonce - The stored nonce
      Returns:
      The Token
      Throws:
      IOException - if an error occurs
      TokenValidationException - If the token validation failed
      Since:
      2.0.0
    • getService

      public static TokenService getService()
      Deprecated.
      use dependency injection instead
      The token service instance
      Returns:
      the token service instance