Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class ClientRegistration
- Object
- ClientRegistration
This server as a client of one identity provider: the id and secret the provider issued it, the scopes it asks for, and where the provider’s endpoints are.
ClientRegistration google = CommonOAuth2Provider.GOOGLE.getBuilder("google")
.clientId(id).clientSecret(secret).build();
ClientRegistration own = ClientRegistration.withRegistrationId("acme")
.clientId("web").clientSecret(secret)
.issuerUri("https://id.example.com")
.scope("openid", "profile", "email").build();
A registration that names an issuerUri and not the endpoints has them read
from the issuer’s metadata the first time a user signs in through it.
Nested types
interface ClientRegistration.ClientSecretSupplier | Where a client secret comes from when it is not a fixed text: Sign in with Apple’s is a token this server signs. |
class ClientRegistration.ProviderDetails | Where the provider is. |
class ClientRegistration.Builder | Builds a ClientRegistration. |
Fields
public static final String FORM_POST = "form_post" | The response_mode that has the provider answer with a form the browser posts, rather than a redirect. |
Methods
Inherited methods
Field details
FORM_POST
public static final String FORM_POST = "form_post"The
response_mode that has the provider answer with a form the browser
posts, rather than a redirect.Method details
withRegistrationId
public static ClientRegistration.Builder withRegistrationId(String registrationId)A registration under this id, which is the last part of the two paths a
sign-in through it uses.
withClientRegistration
public static ClientRegistration.Builder withClientRegistration(ClientRegistration registration)A builder that starts as a copy of
registration.getRegistrationId
public String getRegistrationId()getClientId
public String getClientId()getClientSecret
public String getClientSecret()The fixed secret, or null when there is none or it is supplied; see
resolveClientSecret.resolveClientSecret
public String resolveClientSecret()
throws IOExceptionThe secret to send now: the fixed one, or what the supplier gives.
Throws
getClientAuthenticationMethod
public ClientAuthenticationMethod getClientAuthenticationMethod()getAuthorizationGrantType
public AuthorizationGrantType getAuthorizationGrantType()getRedirectUri
public String getRedirectUri()Where the provider sends the user back: an address, or a template with
{baseUrl} and {registrationId} in it.getScopes
public Set<String> getScopes()getClientName
public String getClientName()What a login page calls this provider.
getResponseMode
public String getResponseMode()FORM_POST, or null for the provider’s default, a redirect.getProviderDetails
public ClientRegistration.ProviderDetails getProviderDetails()toString
public String toString()Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + ‘@’ + Integer.toHexString(hashCode())