Class TokenService
java.lang.Object
fr.paris.lutece.plugins.oauth2.service.TokenService
TokenService
-
Constructor Summary
ConstructorsConstructorDescriptionTokenService(AuthClientConf defaultClientConfig, AuthServerConf defaultauthServerConfig) Constructs a TokenService -
Method Summary
Modifier and TypeMethodDescriptionstatic TokenServiceDeprecated.use dependency injection insteadgetToken(String strRedirectUri, AuthClientConf clientConfig, AuthServerConf authServerConf, String strAuthorizationCode, javax.servlet.http.HttpSession session, JWTParser jWTParser, String strStoredNonce, String strCodeVerifier) Retrieve a token using an authorization codegetToken(String strAuthorizationCode, javax.servlet.http.HttpSession session, JWTParser jWTParser, String strStoredNonce) Retrieve a token using an authorization codegetTokenByRefreshToken(AuthClientConf clientConfig, AuthServerConf authServerConf, String strRefreshToken) Get new Token using refresh tokengetTokenByRefreshToken(String strRefreshToken) Get new Token using refresh tokenparse(String strJson, AuthClientConf clientConfig, AuthServerConf serverConfig, JWTParser jwtParser, String strStoredNonce) parse the JSON for a tokenparse(String strJson, Instant creationTime, AuthClientConf clientConfig, AuthServerConf serverConfig, JWTParser jwtParser, String strStoredNonce) parse the JSON for a tokenbooleanvalidateRefreshToken(AuthClientConf clientConfig, AuthServerConf authServerConf, String strRefreshToken) Validate refresh tokenbooleanvalidateRefreshToken(String strRefreshToken) Validate refresh token
-
Constructor Details
-
TokenService
public TokenService(@Named("oauth2.client") AuthClientConf defaultClientConfig, @Named("oauth2.server") AuthServerConf defaultauthServerConfig) Constructs a TokenService- Parameters:
defaultClientConfig- default client configdefaultauthServerConfig- 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 codesession- The HTTP session- Returns:
- The token
- Throws:
IOException- if an error occursfr.paris.lutece.util.httpaccess.HttpAccessException- if an error occursTokenValidationException- 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- strRedirectUristrAuthorizationCode- The authorization codesession- The HTTP session- Returns:
- The token
- Throws:
IOException- if an error occursfr.paris.lutece.util.httpaccess.HttpAccessException- if an error occursTokenValidationException- If the token validation failed
-
validateRefreshToken
Validate refresh token- Parameters:
clientConfig- ClientConfauthServerConf- AutConfstrRefreshToken- 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- ClientConfauthServerConf- AutConfstrRefreshToken- refreshToken- Returns:
- true if the refresh token is already good
-
getTokenByRefreshToken
Get new Token using refresh token- Parameters:
clientConfig- ClientConfauthServerConf- AutConfstrRefreshToken- 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- ClientConfauthServerConf- AutConfstrRefreshToken- 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 JSONclientConfig- The client configurationserverConfig- The server configurationstrStoredNonce- The stored nonce- Returns:
- The Token
- Throws:
IOException- if an error occursTokenValidationException- 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 JSONcreationTime- The creation time of the tokenclientConfig- The client configurationserverConfig- The server configurationstrStoredNonce- The stored nonce- Returns:
- The Token
- Throws:
IOException- if an error occursTokenValidationException- If the token validation failed- Since:
- 2.0.0
-
getService
Deprecated.use dependency injection insteadThe token service instance- Returns:
- the token service instance
-