Interface OAuth


public interface OAuth
Interface OAuth represents the implementation required for OAuth 2.0 authentication.
Since:
V5.1
  • Method Summary

    Modifier and Type Method Description
    void authorize​(java.lang.String name)
    Authenticates the user with the application configured in the OAuth configurations on the Ebase server administration application.
    void authorize​(java.lang.String name, java.lang.String scope)
    Authenticates the user with the application configured in the OAuth configurations on the Ebase server administration application.
    void authorize​(java.lang.String name, java.lang.String scope, java.util.Map<java.lang.String,​java.lang.Object> additionalParameters)
    Authenticates the user with the application configured in the OAuth configurations on the Ebase server administration application.
    OAuthTokens getTokens​(java.lang.String name)
    Returns an OAuthTokens object containing the access token and the refresh token required with OAuth authentication.
  • Method Details

    • getTokens

      OAuthTokens getTokens​(java.lang.String name)
      Returns an OAuthTokens object containing the access token and the refresh token required with OAuth authentication. OAuthTokens can be populated using the appropriate set methods or the authorize(String) method automatically populates this object.
      Parameters:
      name - as configured in the OAuth configurations on the Ebase server administration application.
      Since:
      v5.1
      See Also:
      authorize(String)
    • authorize

      void authorize​(java.lang.String name)
      Authenticates the user with the application configured in the OAuth configurations on the Ebase server administration application.

      This method takes the user away from Ebase and to the application that requires authorization to allow Ebase access to the users account information. If the OAuthTokens already contains an access token or refresh token already then there is no need to authorize because the access has already been granted. Otherwise the user is prompted to login to the application to grant access and then is returned back to the Ebase application.

      Javascript example:

       try {
         //RESTful service "MyApp" requires OAUTH authentication. 
         services.security.oauth.authorize("myApp");
         //now perform a rest call
         var code = resources.MyApp.call();
       }
       catch (e) {
         event.owner.addErrorMessage(e.javaException.message);
       }
       
      Parameters:
      name - as configured in the OAuth configurations on the Ebase server administration application.
      Since:
      v5.1
      See Also:
      getTokens(String)
    • authorize

      void authorize​(java.lang.String name, java.lang.String scope)
      Authenticates the user with the application configured in the OAuth configurations on the Ebase server administration application. The scope parameter overrides the scope on the server administration application.

      This method takes the user away from Ebase and to the application that requires authorization to allow Ebase access to the users account information. If the OAuthTokens already contains an access token or refresh token already then there is no need to authorize because the access has already been granted. Otherwise the user is prompted to login to the application to grant access and then is returned back to the Ebase application.

      Javascript example:

       try {
         //RESTful service "MyApp" requires OAUTH authentication. 
         services.security.oauth.authorize("myApp", "private-read, private-write");
         //now perform a rest call
         var code = resources.MyApp.call();
       }
       catch (e) {
         event.owner.addErrorMessage(e.javaException.message);
       }
       
      Parameters:
      name - as configured in the OAuth configurations on the Ebase server administration application.
      scope - access permissions required for the application
      Since:
      v5.1
      See Also:
      getTokens(String)
    • authorize

      void authorize​(java.lang.String name, java.lang.String scope, java.util.Map<java.lang.String,​java.lang.Object> additionalParameters)
      Authenticates the user with the application configured in the OAuth configurations on the Ebase server administration application. The scope parameter overrides the scope on the server administration application. The additionalParameters overrides any additional parameters configured on the administration application.

      This method takes the user away from Ebase and to the application that requires authorization to allow Ebase access to the users account information. If the OAuthTokens already contains an access token or refresh token already then there is no need to authorize because the access has already been granted. Otherwise the user is prompted to login to the application to grant access and then is returned back to the Ebase application.

      Javascript example:

       try {
         //RESTful service "MyApp" requires OAUTH authentication. 
         var params = {show_dialog : true};
         services.security.oauth.authorize("myApp", "private-read, private-write", params);
         //now perform a rest call
         var code = resources.MyApp.call();
       }
       catch (e) {
         event.owner.addErrorMessage(e.javaException.message);
       }
       
      Parameters:
      name - as configured in the OAuth configurations on the Ebase server administration application.
      scope - access permissions required for the application
      additionalParameters - Sets any additional parameters for authentication that are required OAuth .
      Since:
      v5.3.1
      See Also:
      getTokens(String)