Class EmbeddedOidcProviderStub
java.lang.Object
de.bund.bva.isyfact.security.test.oidcprovider.EmbeddedOidcProviderStub
- Direct Known Subclasses:
OidcProviderMockBase
This class simulates the base functions of an OpenID Connect (OIDC) provider for tests in environments
in which no dedicated OIDC provider can be used.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEmbeddedOidcProviderStub(String host, int port, String issuerPath) EmbeddedOidcProviderStub(String host, int port, String issuerPath, int tokenLifespan) EmbeddedOidcProviderStub(String host, int port, String issuerPath, String publicKey, String privateKey) EmbeddedOidcProviderStub(String host, int port, String issuerPath, String publicKey, String privateKey, int tokenLifespan) EmbeddedOidcProviderStub(String host, int port, String issuerPath, KeyPair keyPair) EmbeddedOidcProviderStub(String host, int port, String issuerPath, KeyPair keyPair, int tokenLifespan) Create an OIDC provider stub with the given configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected URIappendPath(URI baseUri, String path) org.springframework.security.oauth2.jwt.JwtClaimsSetgetAccessToken(UUID userId, String clientId, String userName, Optional<String> bhknz, Set<String> roles) org.springframework.security.oauth2.jwt.JwtClaimsSetgetAccessToken(UUID userId, String clientId, String userName, Optional<String> bhknz, Set<String> roles, int newTokenLifespan) getAccessTokenResponse(org.springframework.security.oauth2.jwt.JwtClaimsSet claims) getAccessTokenString(UUID userId, String clientId, String userName, Optional<String> bhknz, Set<String> roles) getAccessTokenString(org.springframework.security.oauth2.jwt.JwtClaimsSet claims) getHost()com.nimbusds.jose.jwk.JWKSetgetOIDCConfigResponse(String jwksEndpoint, String authorizationEndpoint, String tokenEndpoint) Returns an OIDC Configuration Response with the URIs that point to the other endpoints provided by the mock.intgetPort()voidsetRolesClaimName(String rolesClaimName) Sets the claim to store the user roles in.
-
Field Details
-
DEFAULT_ROLES_CLAIM_NAME
Default name of the claim to store the user roles in.- See Also:
-
BHKNZ_CLAIM_NAME
Name of the claim to store the BHKNZ in.- See Also:
-
-
Constructor Details
-
EmbeddedOidcProviderStub
-
EmbeddedOidcProviderStub
-
EmbeddedOidcProviderStub
-
EmbeddedOidcProviderStub
-
EmbeddedOidcProviderStub
-
EmbeddedOidcProviderStub
public EmbeddedOidcProviderStub(String host, int port, String issuerPath, KeyPair keyPair, int tokenLifespan) Create an OIDC provider stub with the given configuration.- Parameters:
host- the host the provider is running onport- the port the provider is running onissuerPath- the path that is part of the issuer identifier, may be the empty stringkeyPair- RSA key pair to use for signing JWT and to return from the JWKS endpointtokenLifespan- lifespan of the access tokens issued by the provider
-
-
Method Details
-
setRolesClaimName
Sets the claim to store the user roles in. The default isDEFAULT_ROLES_CLAIM_NAME. The value must be set before any access token is generated!- Parameters:
rolesClaimName- name of the roles claim
-
getHost
-
getPort
public int getPort() -
getIssuer
-
getPublicKey
-
getOIDCConfigResponse
public String getOIDCConfigResponse(String jwksEndpoint, String authorizationEndpoint, String tokenEndpoint) Returns an OIDC Configuration Response with the URIs that point to the other endpoints provided by the mock.- Parameters:
jwksEndpoint- path to the JWKS endpointauthorizationEndpoint- path to the authorization endpointtokenEndpoint- path to the token endpoint- Returns:
- JSON representation of the configuration
-
getJwksResponse
-
getAccessTokenResponse
-
getAccessTokenResponse
-
getAccessTokenString
-
getAccessTokenString
-
getAccessToken
-
getAccessToken
-
getAccessTokenString
-
getJwkSet
public com.nimbusds.jose.jwk.JWKSet getJwkSet() -
appendPath
-