Class RefreshableOpenIdConnectServiceAccount
- java.lang.Object
-
- com.aquima.web.boot.security.openid.RefreshableOpenIdConnectServiceAccount
-
- All Implemented Interfaces:
OpenIdConnectAuthentication
,OpenIdConnectServiceAuthentication
,com.blueriq.component.api.security.BlueriqAuthentication
,com.blueriq.component.api.security.BlueriqServiceAccount
,Serializable
,Principal
,org.springframework.security.core.Authentication
public class RefreshableOpenIdConnectServiceAccount extends Object implements OpenIdConnectServiceAuthentication
A service account that is capable of obtaining a new access token when the existing token expires.The
getEncodedAccessToken()
method of this class always returns a valid access token, obtaining a new access token if needed.This class is not serializable. The service account is intended to be switched to temporarily, in order to execute some code as the service account instead of as the logged in user. After the code execution completes the current authentication must be switched back to the original user. Attempting to serialize the service account may indicate that switching back to the original user was not performed.
- Since:
- 11.6
- Author:
- Petru Galanton
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RefreshableOpenIdConnectServiceAccount(OpenIdConnectServiceAuthentication delegate, OpenIdConnectClient client, org.springframework.security.authentication.AuthenticationManager authManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<? extends org.springframework.security.core.GrantedAuthority>
getAuthorities()
Object
getCredentials()
Object
getDetails()
String
getEncodedAccessToken()
The access token in encoded form.String
getName()
Object
getPrincipal()
String
getProperty(String name)
List<String>
getPropertyNames()
List<String>
getRoles()
List<String>
getTeams()
boolean
isAccessTokenExpired()
boolean
isAnonymous()
boolean
isAuthenticated()
boolean
isAutomatic()
void
setAuthenticated(boolean isAuthenticated)
-
-
-
Constructor Detail
-
RefreshableOpenIdConnectServiceAccount
public RefreshableOpenIdConnectServiceAccount(OpenIdConnectServiceAuthentication delegate, OpenIdConnectClient client, org.springframework.security.authentication.AuthenticationManager authManager)
-
-
Method Detail
-
getTeams
public List<String> getTeams()
- Specified by:
getTeams
in interfacecom.blueriq.component.api.security.BlueriqAuthentication
-
getRoles
public List<String> getRoles()
- Specified by:
getRoles
in interfacecom.blueriq.component.api.security.BlueriqAuthentication
-
isAnonymous
public boolean isAnonymous()
- Specified by:
isAnonymous
in interfacecom.blueriq.component.api.security.BlueriqAuthentication
-
isAutomatic
public boolean isAutomatic()
- Specified by:
isAutomatic
in interfacecom.blueriq.component.api.security.BlueriqAuthentication
-
getPropertyNames
public List<String> getPropertyNames()
- Specified by:
getPropertyNames
in interfacecom.blueriq.component.api.security.BlueriqAuthentication
-
getProperty
public String getProperty(String name)
- Specified by:
getProperty
in interfacecom.blueriq.component.api.security.BlueriqAuthentication
-
getAuthorities
public Collection<? extends org.springframework.security.core.GrantedAuthority> getAuthorities()
- Specified by:
getAuthorities
in interfaceorg.springframework.security.core.Authentication
-
getCredentials
public Object getCredentials()
- Specified by:
getCredentials
in interfaceorg.springframework.security.core.Authentication
-
getDetails
public Object getDetails()
- Specified by:
getDetails
in interfaceorg.springframework.security.core.Authentication
-
getPrincipal
public Object getPrincipal()
- Specified by:
getPrincipal
in interfaceorg.springframework.security.core.Authentication
-
isAuthenticated
public boolean isAuthenticated()
- Specified by:
isAuthenticated
in interfaceorg.springframework.security.core.Authentication
-
setAuthenticated
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException
- Specified by:
setAuthenticated
in interfaceorg.springframework.security.core.Authentication
- Throws:
IllegalArgumentException
-
getEncodedAccessToken
public String getEncodedAccessToken()
Description copied from interface:OpenIdConnectAuthentication
The access token in encoded form. This form is suitable for use in an Authorization: Bearer header.- Specified by:
getEncodedAccessToken
in interfaceOpenIdConnectAuthentication
- Returns:
- the encoded access token
-
isAccessTokenExpired
public boolean isAccessTokenExpired()
- Specified by:
isAccessTokenExpired
in interfaceOpenIdConnectServiceAuthentication
- Returns:
- true if the access token is expired
-
-