Class OAuth2Service
- java.lang.Object
-
- io.jans.ca.plugin.adminui.service.BaseService
-
- io.jans.ca.plugin.adminui.service.auth.OAuth2Service
-
@Singleton public class OAuth2Service extends BaseService
-
-
Field Summary
-
Fields inherited from class io.jans.ca.plugin.adminui.service.BaseService
httpService, mapper, TLS_ALLOWED_CIPHER_SUITES, TLS_ENABLED_PROTOCOLS
-
-
Constructor Summary
Constructors Constructor Description OAuth2Service()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenResponsegetApiProtectionToken(ApiTokenRequest apiTokenRequest, String appType)Obtain an API protection token for the specified application and populate its token claims.io.jans.configapi.core.model.adminui.AdminUISessiongetSession(String sessionId)Load an AdminUISession by its session identifier.voidremoveAdminUIUserSessionByDn(String userDn)Removes all AdminUISession entries whose jansUsrDN contains the provided user DN.voidremoveSession(String sessionId)Removes the Admin UI session identified by the given sessionId.voidsetAdminUISession(String sessionId, String ujwt)Create and persist an AdminUISession for the given sessionId using claims extracted from the provided user-info JWT.-
Methods inherited from class io.jans.ca.plugin.adminui.service.BaseService
executeDCR, getToken, getToken, introspectToken
-
-
-
-
Method Detail
-
getApiProtectionToken
public TokenResponse getApiProtectionToken(ApiTokenRequest apiTokenRequest, String appType) throws ApplicationException
Obtain an API protection token for the specified application and populate its token claims. Uses the AUI configuration for the given appType to request a client-credentials token; when an ApiTokenRequest with a user JWT (ujwt) is provided, the request includes that JWT. The returned TokenResponse contains the access, ID, and refresh tokens and, when available from token introspection, scopes, issued-at (iat), expiration (exp), and issuer (iss) claims.- Parameters:
apiTokenRequest- optional request parameters; when null a default OpenID scope is requested, otherwise the contained `ujwt` (if present) is used to obtain the tokenappType- identifier of the application configuration to use for token endpoint, client credentials, and introspection endpoint lookup- Returns:
- a TokenResponse populated with accessToken, idToken, refreshToken and, if available, scopes, iat, exp, and issuer
- Throws:
ApplicationException- on error while obtaining or processing the token
-
setAdminUISession
public void setAdminUISession(String sessionId, String ujwt) throws ApplicationException
Create and persist an AdminUISession for the given sessionId using claims extracted from the provided user-info JWT.- Parameters:
sessionId- the identifier for the admin UI session; used as the session's inum and to build its DNujwt- the user-info JWT string containing an "inum" claim that identifies the user- Throws:
ApplicationException- if the "inum" claim is missing from the provided JWT
-
removeAdminUIUserSessionByDn
public void removeAdminUIUserSessionByDn(String userDn) throws ApplicationException
Removes all AdminUISession entries whose jansUsrDN contains the provided user DN.- Parameters:
userDn- the user distinguished name to match within stored AdminUISession jansUsrDN values- Throws:
ApplicationException- if an error occurs while searching for or removing sessions (results in HTTP 500)
-
getSession
public io.jans.configapi.core.model.adminui.AdminUISession getSession(String sessionId) throws ApplicationException
Load an AdminUISession by its session identifier.- Parameters:
sessionId- the session identifier used to build the session DN- Returns:
- the matching AdminUISession, or `null` if no session exists for the given id
- Throws:
ApplicationException- if an error occurs while retrieving the session (results in HTTP 500)
-
removeSession
public void removeSession(String sessionId) throws ApplicationException
Removes the Admin UI session identified by the given sessionId.- Parameters:
sessionId- the Admin UI session identifier- Throws:
ApplicationException- if the session cannot be retrieved or removed
-
-