Interface ClientRegistrationPolicy
public interface ClientRegistrationPolicy
What decides who may register a client of their own at the registration
endpoint (RFC 7591), and with what. Registration is off until one is given
to clientRegistration(...) on the authorization server configurer.
The server parses and checks the request first, and only a request that
passes reaches validate(HttpServer.Request, Map, RegisteredClient). What every self-registered client is, whatever
the policy says:
- public:
token_endpoint_auth_methodisnoneand it has no secret, since anybody can register one and a secret proves nothing about them; - PKCE (S256) is required, and so is the user's consent on every authorization, so that a client nobody vetted is never granted anything silently;
- grant types
authorization_code, optionally withrefresh_token, and response typecode; - one to five redirect addresses, each an
httpsaddress, or anhttpone on127.0.0.1or[::1]-- any port is then accepted, as RFC 8252 asks for an application on the user's computer; no fragment, no user information; - scopes out of
allowedScopes(), all of them when the request names none; - no resource servers and no audience of its own choosing.
A client that validate(HttpServer.Request, Map, RegisteredClient) returns which breaks one of these is not saved,
and the request is answered 500: that is a mistake in the policy, not in
the request.
-
Method Summary
Modifier and TypeMethodDescriptionThe scopes a self-registered client may be given.validate(HttpServer.Request request, Map<String, Object> metadata, RegisteredClient client) The validate-and-limit hook: refuse the registration by throwing aClientRegistrationException, or return the client to save -- the one given, or one built from it with less (fewer redirects, fewer scopes, shorter token lifetimes).
-
Method Details
-
allowedScopes
-
validate
RegisteredClient validate(HttpServer.Request request, Map<String, Object> metadata, RegisteredClient client) The validate-and-limit hook: refuse the registration by throwing aClientRegistrationException, or return the client to save -- the one given, or one built from it with less (fewer redirects, fewer scopes, shorter token lifetimes). It is also the place to count registrations per address and refuse past a limit -- and the only such place: the endpoint takes anonymous requests, and every registration it accepts is a saved client, so a policy that accepts everything lets anyone fill the client table.- Parameters:
request- the HTTP requestmetadata- the client metadata the request sent, as parsed JSONclient- the client the server would save- Returns:
- the client to save
-