Class RestAuthenticator
java.lang.Object
org.apache.juneau.rest.server.auth.RestAuthenticator
- Direct Known Subclasses:
RestAuthenticator.Null
Resource-level authentication SPI for
@Rest resources.
Resolves a request's Principal and roles, reusing the same Authenticator
implementations (SAML/OAuth/JWT/API-key) used by the servlet-filter layer. Same three-state contract as
Authenticator:
Optional.empty()— does not apply (anonymous passthrough).Optional.of(AuthResult)— authentication succeeded.- throw
AuthenticationException— credentials present but invalid.
See Also:
- Since:
- 10.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSentinel "unset" type for@Rest(authenticator=...); never authenticates. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract Optional<AuthResult>authenticate(RestRequest req) Resolves identity + roles for the request.static RestAuthenticatorof(Authenticator a)
-
Constructor Details
-
RestAuthenticator
public RestAuthenticator()
-
-
Method Details
-
authenticate
Resolves identity + roles for the request.- Parameters:
req- The REST request. Nevernull .- Returns:
- The auth result, or
Optional.empty()if this authenticator does not apply. - Throws:
AuthenticationException- If credentials are present but invalid.
-
of
- Parameters:
a- The authenticator to adapt. Must not benull .- Returns:
- A new
RestAuthenticator.
-