Class SolidOidcSession
java.lang.Object
com.janeirodigital.sai.authentication.SolidOidcSession
- All Implemented Interfaces:
AuthorizedSession
,Serializable
Implementation of
AuthorizedSession
for
Solid-OIDC. Must use
SolidOidcSession.Builder
for session creation.- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static com.nimbusds.oauth2.sdk.dpop.DPoPProofFactory
getDPoPProofFactory
(com.nimbusds.jose.jwk.ECKey ecJwk) Gets a DPoP proof factory that can be used for generate DPoP proofs for requests made by the session.protected static com.nimbusds.jose.jwk.ECKey
getEllipticCurveKey
(com.nimbusds.jose.jwk.Curve curve) protected static com.nimbusds.jwt.SignedJWT
getProof
(com.nimbusds.oauth2.sdk.dpop.DPoPProofFactory proofFactory, com.janeirodigital.sai.httputils.HttpMethod method, URI uri) Gets the required DPoP proof that must be created for each request based on themethod
and targeturi
.protected static com.nimbusds.oauth2.sdk.token.Tokens
obtainTokens
(URI oidcTokenEndpoint, com.nimbusds.oauth2.sdk.id.ClientID clientId, com.nimbusds.oauth2.sdk.AuthorizationGrant grant, com.nimbusds.oauth2.sdk.dpop.DPoPProofFactory proofFactory) Post a token request to the token endpoint provided inoidcProviderMetadata
.void
refresh()
Refreshes the tokens associated with the session.toHttpHeaders
(com.janeirodigital.sai.httputils.HttpMethod method, URI uri) Generates a map of HTTP Authorization headers that can be use to make authorized requests using the session.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.janeirodigital.sai.authentication.AuthorizedSession
getAccessToken, getApplicationId, getId, getOidcProviderId, getRefreshToken, getSocialAgentId
-
Constructor Details
-
SolidOidcSession
-
-
Method Details
-
toHttpHeaders
public Map<String,String> toHttpHeaders(com.janeirodigital.sai.httputils.HttpMethod method, URI uri) throws SaiAuthenticationException Generates a map of HTTP Authorization headers that can be use to make authorized requests using the session. DPoP requires a proof to be created for each request based on themethod
and targeturi
.- Specified by:
toHttpHeaders
in interfaceAuthorizedSession
- Parameters:
method
- HTTP method of the requesturi
- Target URI of the request- Returns:
- Map of HTTP Authorization headers
- Throws:
SaiAuthenticationException
-
refresh
Refreshes the tokens associated with the session. Session must have been established as refreshable upon creation.- Specified by:
refresh
in interfaceAuthorizedSession
- Throws:
SaiAuthenticationException
-
getProof
protected static com.nimbusds.jwt.SignedJWT getProof(com.nimbusds.oauth2.sdk.dpop.DPoPProofFactory proofFactory, com.janeirodigital.sai.httputils.HttpMethod method, URI uri) throws SaiAuthenticationException Gets the required DPoP proof that must be created for each request based on themethod
and targeturi
.- Parameters:
proofFactory
- DPoP proof factorymethod
- HTTP method of the requesturi
- Target URI of the request- Returns:
- DPoP proof
- Throws:
SaiAuthenticationException
-
getEllipticCurveKey
protected static com.nimbusds.jose.jwk.ECKey getEllipticCurveKey(com.nimbusds.jose.jwk.Curve curve) throws SaiAuthenticationException - Throws:
SaiAuthenticationException
-
getDPoPProofFactory
protected static com.nimbusds.oauth2.sdk.dpop.DPoPProofFactory getDPoPProofFactory(com.nimbusds.jose.jwk.ECKey ecJwk) throws SaiAuthenticationException Gets a DPoP proof factory that can be used for generate DPoP proofs for requests made by the session.- Parameters:
ecJwk
- Elliptic Curve JWK- Returns:
- DPoPProofFactory
- Throws:
SaiAuthenticationException
-
obtainTokens
protected static com.nimbusds.oauth2.sdk.token.Tokens obtainTokens(URI oidcTokenEndpoint, com.nimbusds.oauth2.sdk.id.ClientID clientId, com.nimbusds.oauth2.sdk.AuthorizationGrant grant, com.nimbusds.oauth2.sdk.dpop.DPoPProofFactory proofFactory) throws SaiAuthenticationException Post a token request to the token endpoint provided inoidcProviderMetadata
. Used in both the initial token request as well as in subsequent token refreshes.- Parameters:
oidcTokenEndpoint
- URI of the oidc token endpointclientId
- client identifiergrant
- authorization grantproofFactory
- DPoP proof factory- Returns:
- Tokens object containing requested tokens
- Throws:
SaiAuthenticationException
-