Class StubBearerTokenValidator

java.lang.Object
org.apache.juneau.petstore.auth.StubBearerTokenValidator
All Implemented Interfaces:
TokenValidator

public class StubBearerTokenValidator extends Object implements TokenValidator
Stub TokenValidator for the petstore demo — recognises an in-memory map of opaque bearer tokens.

NOT FOR PRODUCTION USE. This is a sample/demo validator that maps fixed token strings to fixed user principals. Real deployments should plug in JwtTokenValidator from juneau-rest-server-auth-jwt (signed JWTs against a JWKS), an opaque-token store backed by a database, or RFC 7662 introspection.

Default token table:

  • petstore-user → principal "alice"
  • petstore-admin → principal "admin"

Other token strings throw AuthenticationException carrying a WWW-Authenticate: Bearer realm="petstore" challenge — the AuthFilterChain in turn returns 401.