Class AbstractOAuth2AccessAuthorizeManager

java.lang.Object
net.sourceforge.plantuml.security.authentication.oauth.AbstractOAuth2AccessAuthorizeManager
All Implemented Interfaces:
SecurityAuthorizeManager
Direct Known Subclasses:
OAuth2ClientAccessAuthorizeManager, OAuth2ResourceOwnerAccessAuthorizeManager

public abstract class AbstractOAuth2AccessAuthorizeManager extends java.lang.Object implements SecurityAuthorizeManager
Default abstract OAuth2 AccessAuthorizeManager for OAuth2 managers.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected java.util.Map<java.lang.String,java.lang.Object>
    buildAccessDataFromResponse(JsonObject tokenResponse, java.lang.String tokenType)
    Builds the access parameter map.
    protected java.util.Map<java.lang.String,java.lang.Object>
    Default headers for token service access.
    requestAndCreateAuthFromResponse(java.net.Proxy proxy, java.lang.String grantType, java.lang.String tokenType, SURL tokenService, java.lang.String content, SecurityAuthentication basicAuth)
    Calls the endpoint to load the token response and create a SecurityAuthentication.
    protected java.lang.String
    urlEncode(java.lang.String data)
    Encodes the data to UTF-8 into application/x-www-form-urlencoded.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.sourceforge.plantuml.security.authentication.SecurityAuthorizeManager

    create
  • Constructor Details

    • AbstractOAuth2AccessAuthorizeManager

      public AbstractOAuth2AccessAuthorizeManager()
  • Method Details

    • headers

      protected java.util.Map<java.lang.String,java.lang.Object> headers()
      Default headers for token service access.

      Initialize with:

       "Content-Type"="application/x-www-form-urlencoded; charset=UTF-8"
       "Accept"="application/json"
       
      Returns:
      headers
    • buildAccessDataFromResponse

      protected java.util.Map<java.lang.String,java.lang.Object> buildAccessDataFromResponse(JsonObject tokenResponse, java.lang.String tokenType)
      Builds the access parameter map.
      Parameters:
      tokenResponse - the JSOn object with the response data
      tokenType - token type to use instead of token_type from response
      Returns:
      data-map
    • urlEncode

      protected java.lang.String urlEncode(java.lang.String data)
      Encodes the data to UTF-8 into application/x-www-form-urlencoded.
      Parameters:
      data - data to encode
      Returns:
      the encoded data
    • requestAndCreateAuthFromResponse

      protected SecurityAuthentication requestAndCreateAuthFromResponse(java.net.Proxy proxy, java.lang.String grantType, java.lang.String tokenType, SURL tokenService, java.lang.String content, SecurityAuthentication basicAuth)
      Calls the endpoint to load the token response and create a SecurityAuthentication.
      Parameters:
      proxy - Proxy for the access
      grantType - grant type
      tokenType - token type to use instead of token_type from response
      tokenService - URL to token service
      content - body content
      basicAuth - principal basicAuth
      Returns:
      the authentication object to access resources (or null)