Enum CommonOAuth2Provider

java.lang.Object
java.lang.Enum<CommonOAuth2Provider>
com.codename1.backend.security.oauth2.client.CommonOAuth2Provider
All Implemented Interfaces:
Comparable<CommonOAuth2Provider>

public enum CommonOAuth2Provider extends Enum<CommonOAuth2Provider>

The settings of the identity providers most applications sign in through, so that a registration needs only the id and secret the provider issued.

CommonOAuth2Provider.GITHUB.getBuilder("github").clientId(id).clientSecret(secret).build();
  • Enum Constant Details

    • GOOGLE

      public static final CommonOAuth2Provider GOOGLE
      Google, with OpenID Connect.
    • GITHUB

      public static final CommonOAuth2Provider GITHUB

      GitHub, which is OAuth2 without OpenID Connect: the user is read from its API, and named by the numeric id.

      GitHub's user says nothing of whether an address is verified, and may show none at all. The verified ones are listed at /user/emails, which the user:email scope asked for here opens; see ClientRegistration.ProviderDetails.getUserEmailsUri().

    • MICROSOFT

      public static final CommonOAuth2Provider MICROSOFT
      Microsoft's identity platform at its multi-tenant common endpoints, which accept accounts of any organisation and personal ones. Tokens are issued under the address of the account's own tenant, so the issuer is held to the tenant template rather than to one address; an application that admits one tenant only should also check the tid claim.
    • APPLE

      public static final CommonOAuth2Provider APPLE
      Sign in with Apple. Apple answers with a form the browser posts, and its client secret is a token signed with the key Apple issued: give the builder a ClientRegistration.Builder.clientSecretSupplier made by AppleClientSecret.
  • Method Details

    • values

      public static CommonOAuth2Provider[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static CommonOAuth2Provider valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getBuilder

      public abstract ClientRegistration.Builder getBuilder(String registrationId)
      A builder with the provider's settings in it, wanting the client id and secret.
    • of

      public static CommonOAuth2Provider of(String name)
      The provider of this name, in any case, or null.