Package org.jenkinsci.plugins
Class KeycloakAuthentication
java.lang.Object
org.acegisecurity.providers.AbstractAuthenticationToken
org.jenkinsci.plugins.KeycloakAuthentication
- All Implemented Interfaces:
Serializable,Principal,Authentication
- Author:
- Mohammad Nadeem, dev.lauer@elnarion.de
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionKeycloakAuthentication(org.keycloak.representations.IDToken idToken, org.keycloak.representations.AccessToken accessToken, String refreshToken, org.keycloak.representations.AccessTokenResponse tokenResponse) Constructor -
Method Summary
Modifier and TypeMethodDescriptionGet the keycloak access tokenorg.keycloak.representations.AccessTokenResponseReturns the latest AccessTokenResponseGet the date the token is fromGet the date the token is fromgetName()Get the keycloak refresh tokenbooleanChecks whether the access token is expired or not.booleanChecks whether the refresh token is expired or not.voidsetAccessToken(String accessToken) Sets the access tokenvoidsetAccessTokenResponse(org.keycloak.representations.AccessTokenResponse accessTokenResponse) Sets the latest AccessTokenResponsevoidsetLastRefresh(Date lastRefresh) Set the date the token is fromvoidsetRefreshToken(String refreshToken) Sets the refresh tokenMethods inherited from class org.acegisecurity.providers.AbstractAuthenticationToken
equals, getAuthorities, getDetails, hashCode, isAuthenticated, setAuthenticated, setDetails, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.acegisecurity.Authentication
toSpring
-
Constructor Details
-
KeycloakAuthentication
public KeycloakAuthentication(org.keycloak.representations.IDToken idToken, org.keycloak.representations.AccessToken accessToken, String refreshToken, org.keycloak.representations.AccessTokenResponse tokenResponse) Constructor- Parameters:
idToken- the keycloak id tokenaccessToken- the keycloak access tokenrefreshToken- the keycloak refresh tokentokenResponse- theAccessTokenResponse
-
-
Method Details
-
getName
- Specified by:
getNamein interfacePrincipal- Overrides:
getNamein classAbstractAuthenticationToken
-
getCredentials
-
getPrincipal
-
getRefreshToken
Get the keycloak refresh token- Returns:
Stringthe refresh token
-
getAccessToken
Get the keycloak access token- Returns:
Stringthe access token
-
setRefreshToken
Sets the refresh token- Parameters:
refreshToken-String
-
setAccessToken
Sets the access token- Parameters:
accessToken-String
-
getAccessTokenResponse
public org.keycloak.representations.AccessTokenResponse getAccessTokenResponse()Returns the latest AccessTokenResponse- Returns:
AccessTokenResponse
-
setAccessTokenResponse
public void setAccessTokenResponse(org.keycloak.representations.AccessTokenResponse accessTokenResponse) Sets the latest AccessTokenResponse- Parameters:
accessTokenResponse-
-
getLastRefresh
Get the date the token is from- Returns:
Date
-
getLastRefreshDateAsCalendar
Get the date the token is from- Returns:
Calendar
-
setLastRefresh
Set the date the token is from- Parameters:
lastRefresh-
-
isRefreshExpired
public boolean isRefreshExpired()Checks whether the refresh token is expired or not.- Returns:
- boolean - the result of the check
-
isAccessExpired
public boolean isAccessExpired()Checks whether the access token is expired or not.- Returns:
- boolean - the result of the check
-