Class ClientAuthConfiguration
java.lang.Object
com.irurueta.authserver.authorization.api.web.clientauth.ClientAuthConfiguration
@Configuration(value="clientAuthWebConfiguration",
proxyBeanMethods=false)
@EnableConfigurationProperties({MtlsProperties.class,ClientAssertionProperties.class,X509Properties.class})
public class ClientAuthConfiguration
extends Object
Wires the client authentication methods
private_key_jwt (with replay protection) and mutual TLS into the
protocol chain. Nothing outside this feature is edited: the chain applies every ProtocolChainCustomizer
bean, in order.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclientAuthProtocolChainCustomizer(RegisteredJwksClientAssertionDecoderFactory decoderFactory, ClientCertificateVerifier verifier, MtlsEndpointAliases endpointAliases) Declares the customizer of the protocol chain, applied after the multi-factor, step-up and device ones.clientCertificateVerifier(MtlsTrustAnchors trustAnchors, org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository registeredClients, org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService authorizationService) Declares the verifier of the client certificates.mtlsEndpointAliases(X509Properties x509Properties, org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings settings) Declares the builder of themtls_endpoint_aliasesclaim.mtlsTrustAnchors(MtlsProperties properties, TrustAnchorsReader reader) Loads the trusted certificate authorities once.registeredJwksClientAssertionDecoderFactory(ReplayRejectingJwtValidator replayValidator) Declares the factory of the assertion decoders.replayRejectingJwtValidator(RegisterClientAssertionUseCase registerClientAssertion, ClientAssertionProperties properties, Clock clock) Declares the validator of the lifetime and replay of the assertions.
-
Constructor Details
-
ClientAuthConfiguration
public ClientAuthConfiguration()
-
-
Method Details
-
mtlsTrustAnchors
@Bean public MtlsTrustAnchors mtlsTrustAnchors(MtlsProperties properties, TrustAnchorsReader reader) Loads the trusted certificate authorities once.- Parameters:
properties- the configured PEM files.reader- reads the files.- Returns:
- the trust anchors.
-
replayRejectingJwtValidator
@Bean public ReplayRejectingJwtValidator replayRejectingJwtValidator(RegisterClientAssertionUseCase registerClientAssertion, ClientAssertionProperties properties, Clock clock) Declares the validator of the lifetime and replay of the assertions.- Parameters:
registerClientAssertion- records the use of an assertion.properties- settings of the assertions.clock- source of the current instant.- Returns:
- the validator.
-
registeredJwksClientAssertionDecoderFactory
@Bean public RegisteredJwksClientAssertionDecoderFactory registeredJwksClientAssertionDecoderFactory(ReplayRejectingJwtValidator replayValidator) Declares the factory of the assertion decoders.- Parameters:
replayValidator- the validator of the lifetime and replay.- Returns:
- the factory.
-
clientCertificateVerifier
@Bean public ClientCertificateVerifier clientCertificateVerifier(MtlsTrustAnchors trustAnchors, org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository registeredClients, org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService authorizationService) Declares the verifier of the client certificates.- Parameters:
trustAnchors- the trusted authorities.registeredClients- finds the clients.authorizationService- stores the authorizations.- Returns:
- the verifier.
-
mtlsEndpointAliases
@Bean public MtlsEndpointAliases mtlsEndpointAliases(X509Properties x509Properties, org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings settings) Declares the builder of themtls_endpoint_aliasesclaim.- Parameters:
x509Properties- settings of the TLS port.settings- settings of the protocol endpoints.- Returns:
- the builder.
-
clientAuthProtocolChainCustomizer
@Bean @Order(3) public ProtocolChainCustomizer clientAuthProtocolChainCustomizer(RegisteredJwksClientAssertionDecoderFactory decoderFactory, ClientCertificateVerifier verifier, MtlsEndpointAliases endpointAliases) Declares the customizer of the protocol chain, applied after the multi-factor, step-up and device ones.- Parameters:
decoderFactory- creates the assertion decoders.verifier- verifies the client certificates.endpointAliases- builds the metadata claim.- Returns:
- the customizer.
-