Class Microsoft

  • All Implemented Interfaces:
    IOAuthService

    public class Microsoft
    extends AbstractOAuthService
    Microsoft identity platform service can be used for a specific tenant or the default "common" tentant.
    • Field Detail

      • SCOPE_user_read

        public static final java.lang.String SCOPE_user_read
        The User Read Public Profile scope: "User.Read".
        See Also:
        Constant Field Values
      • SCOPE_openid

        public static final java.lang.String SCOPE_openid
        The Open ID scope: "openid".
        See Also:
        Constant Field Values
    • Constructor Detail

      • Microsoft

        public Microsoft​(OAuthSession session,
                         java.lang.String tenant,
                         java.lang.String clientID,
                         java.lang.String clientSecret,
                         java.lang.String... scopes)
        Constructs the service.
        Parameters:
        session - The OAuthSession.
        tenant - The tenant in Microsoft Azure, formatted as "12345abc-12ab-34cd-56ef-012345abcdef", null or "common" or empty string for the "common" tenant.
        clientID - The Client ID, formatted as "12345abc-12ab-34cd-56ef-012345abcdef".
        clientSecret - The Client Secret, formatted as "ABab0_1uxyTv-O.aQwERTY_12abCDeF_7_".
        scopes - The list of scopes as an array, or none for default scopes:In order to retrieve the user profile information using {@link #getUserProfileInfo()}, you MUST either leave scopes empty or specify the scopes {@link #SCOPE_user_read}.
        Throws:
        java.lang.NullPointerException - If clientID, clientSecret or any of the scopes values are null is null.
        java.lang.IllegalArgumentException - If clientID, clientSecret or any of the scopes values is empty.
        java.lang.IllegalStateException - If the authentication engine is not initialized.
    • Method Detail

      • initialize

        public static IServiceCreator<Microsoft> initialize​(java.lang.String tenant,
                                                            java.lang.String clientID,
                                                            java.lang.String clientSecret,
                                                            java.lang.String... scopes)
        Creates an instance of the ParamInitializedService that holds the parameters for the provider authentication.
        Parameters:
        tenant - The tenant in Microsoft Azure, formatted as "12345abc-12ab-34cd-56ef-012345abcdef", null or "common" or empty string for the "common" tenant.
        clientID - The Client ID, formatted as "12345abc-12ab-34cd-56ef-012345abcdef".
        clientSecret - The Client Secret, formatted as "ABab0_1uxyTv-O.aQwERTY_12abCDeF_7_".
        scopes - The list of scopes as an array, or none for default scopes:In order to retrieve the user profile information using {@link #getUserProfileInfo()}, you MUST either leave scopes empty or specify the scopes {@link #SCOPE_user_read}.
        Throws:
        java.lang.NullPointerException - If clientID, clientSecret or any of the scopes values are null is null.
        java.lang.IllegalArgumentException - If clientID, clientSecret or any of the scopes values is empty.
      • getApproximateSize

        public Size getApproximateSize()
        Gets the approximate size in pixels of the inner browser window requested. This setting used when possible, but is not guaranteed.
        Returns:
        The size, or null if none is known (full screen).
      • getLogoutURL

        public java.lang.String getLogoutURL()
        Returns the logout URL for the OAuth service. It is not the same as invalidating an access URL.
        Specified by:
        getLogoutURL in class AbstractOAuthService
        Returns:
        The logout URL is null for none.
      • getUserProfileInfo

        public UserProfileInfo getUserProfileInfo()
                                           throws java.io.IOException,
                                                  java.lang.InterruptedException,
                                                  java.util.concurrent.ExecutionException
        Gets the UserProfileInformation from this service.

        This will cause the user to have to authenticate with the service, unless not already done.

        All fields available for this service that are possible to set and available will be initialized. Other values will be left null, unknown or undefined.

        Specified by:
        getUserProfileInfo in class AbstractOAuthService
        Returns:
        The UserProfileInfo instance.
        Throws:
        java.lang.IllegalStateException - If the authentication has not completed successfully, or if the String "profile" is not among the requested scopes.
        java.util.concurrent.ExecutionException - For execution errors.
        java.lang.InterruptedException - If the revocation action was interrupted.
        java.io.IOException - For I/O errors.