Interface AuthorizedSession
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ClientCredentialsSession,SolidOidcSession
Interface implemented by different types of authorized sessions, typically
different types of OAuth2/OIDC flows. Keeps sai-java classes that require
credentials to access protected resources from having to care about the specifics
of how those credentials are acquired and maintained. See
SolidOidcSession and
ClientCredentialsSession for implementation examples.-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgenerateId(String algorithm, URI socialAgentId, URI applicationId, URI oidcProviderId) Default method that returns a consistent session identifier across implementations for an authorized session scoped to the social agent, application id, and openid provider.Gets theAccessTokenassociated with theAuthorizedSessionGets the URI of the Application identity associated with theAuthorizedSessiondefault StringGets the URI of the OIDC Provider that issued the tokens for theAuthorizedSessionGets theRefreshTokenassociated with theAuthorizedSessionGets the URI of the SocialAgent identity associated with theAuthorizedSessionvoidrefresh()Refreshes the token(s) associated with theAuthorizedSessiontoHttpHeaders(com.janeirodigital.sai.httputils.HttpMethod method, URI uri) Generates a map of HTTP authorization headers that can be added to an HTTP request when accessing protected resources.
-
Method Details
-
getSocialAgentId
URI getSocialAgentId()Gets the URI of the SocialAgent identity associated with theAuthorizedSession- Returns:
- URI of SocialAgent identity
-
getApplicationId
URI getApplicationId()Gets the URI of the Application identity associated with theAuthorizedSession- Returns:
- URI of Application identity
-
getOidcProviderId
URI getOidcProviderId()Gets the URI of the OIDC Provider that issued the tokens for theAuthorizedSession- Returns:
- URI of Application identity
-
getAccessToken
AccessToken getAccessToken()Gets theAccessTokenassociated with theAuthorizedSession- Returns:
AccessToken
-
getRefreshToken
RefreshToken getRefreshToken()Gets theRefreshTokenassociated with theAuthorizedSession- Returns:
RefreshToken
-
toHttpHeaders
Map<String,String> toHttpHeaders(com.janeirodigital.sai.httputils.HttpMethod method, URI uri) throws SaiAuthenticationException Generates a map of HTTP authorization headers that can be added to an HTTP request when accessing protected resources. Some types of sessions (e.g. DPoP) need to know the HTTP method and target URI of the request to generate the headers.- Parameters:
method- HTTP method of the requesturi- Target URI of the request- Returns:
- Map of Authorization Headers
- Throws:
SaiAuthenticationException
-
refresh
Refreshes the token(s) associated with theAuthorizedSession- Throws:
SaiAuthenticationException
-
generateId
static String generateId(String algorithm, URI socialAgentId, URI applicationId, URI oidcProviderId) throws SaiAuthenticationException Default method that returns a consistent session identifier across implementations for an authorized session scoped to the social agent, application id, and openid provider.- Parameters:
algorithm- Message digest algorithm to use- Returns:
- String identifier of an authorized session
- Throws:
SaiAuthenticationException
-
getId
- Throws:
SaiAuthenticationException
-