Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class BearerTokenAuthenticationEntryPoint

  1. Object
  2. BearerTokenAuthenticationEntryPoint

ImplementsAuthenticationEntryPoint

Answers a request that needs a bearer token and has none, or has a bad one, as RFC 6750 3 says to:

401   WWW-Authenticate: Bearer
401   WWW-Authenticate: Bearer realm="orders", scope="orders:read"
401   WWW-Authenticate: Bearer error="invalid_token", error_description="Jwt expired at ...",
                        error_uri="https://tools.ietf.org/html/rfc6750#section-3.1"
400   WWW-Authenticate: Bearer error="invalid_request", error_description="Found multiple ..."

A request that sent no token is told that one is wanted, never an error. When the rule that refused it asks for a scope the challenge names it, and it names the realm when one was set. One that sent a token is told what was wrong with it.

Constructors

public BearerTokenAuthenticationEntryPoint()

Methods

public void setRealmName(String realmName)A realm to name in the challenge; none unless set.
public HttpServer.Response commence(HttpServer.Request request, AuthenticationException authException)The answer.

Inherited methods

Constructor details

BearerTokenAuthenticationEntryPoint

public BearerTokenAuthenticationEntryPoint()

Method details

setRealmName

public void setRealmName(String realmName)
A realm to name in the challenge; none unless set.

commence

public HttpServer.Response commence(HttpServer.Request request, AuthenticationException authException)
The answer.

Parameters

request HttpServer.Request
Not documented.
authException AuthenticationException
why the request was not let through