Class SecurityCredentials

java.lang.Object
net.sourceforge.plantuml.security.authentication.SecurityCredentials
All Implemented Interfaces:
SecurityCredentialsContainer

public class SecurityCredentials extends java.lang.Object implements SecurityCredentialsContainer
Defines a configuration for credentials.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final SecurityCredentials
    No credentials given.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SecurityCredentials(java.lang.String name, java.lang.String type, java.lang.String identifier, char[] secret)
    Creates BasicAuth credentials without a proxy.
    SecurityCredentials(java.lang.String name, java.lang.String type, java.lang.String identifier, char[] secret, java.util.Map<java.lang.String,java.lang.Object> properties, java.net.Proxy proxy)
    Creates BasicAuth credentials with a proxy.
  • Method Summary

    Modifier and Type
    Method
    Description
    basicAuth(java.lang.String identifier, char[] secret)
    Creates BasicAuth credentials.
    boolean
    equals(java.lang.Object o)
     
    void
    Get called, if the secret information should be erased.
    fromJson(JsonValue jsonValue)
    Creates a SecurityCredentials from a JSON.
    java.lang.String
     
    java.lang.String
     
    java.util.Map<java.lang.String,java.lang.Object>
     
    boolean
    getPropertyBool(java.lang.String key)
    Returns the property as boolean.
    char[]
    getPropertyChars(java.lang.String key)
    Returns the property as characters.
    java.lang.Number
    getPropertyNum(java.lang.String key)
    Returns the property as Number.
    java.lang.String
    getPropertyStr(java.lang.String key)
    Returns the property as String.
    java.net.Proxy
     
    char[]
     
    java.lang.String
     
    int
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • SecurityCredentials

      public SecurityCredentials(java.lang.String name, java.lang.String type, java.lang.String identifier, char[] secret)
      Creates BasicAuth credentials without a proxy.
      Parameters:
      name - Name of the credentials
      type - The type of authentication and access process (e.g. "basicauth" or "oauth2")
      identifier - username, clientId, ...
      secret - the secret information to authenticate the client or user
    • SecurityCredentials

      public SecurityCredentials(java.lang.String name, java.lang.String type, java.lang.String identifier, char[] secret, java.util.Map<java.lang.String,java.lang.Object> properties, java.net.Proxy proxy)
      Creates BasicAuth credentials with a proxy.
      Parameters:
      name - Name of the credentials
      type - The type of authentication and access process (e.g. "basicauth" or "oauth2")
      identifier - username, clientId, ...
      secret - the secret information to authenticate the client or user
      proxy - proxy configuration
  • Method Details

    • basicAuth

      public static SecurityCredentials basicAuth(java.lang.String identifier, char[] secret)
      Creates BasicAuth credentials.
      Parameters:
      identifier - the basic auth user name.
      secret - password
      Returns:
      credential object
    • fromJson

      public static SecurityCredentials fromJson(JsonValue jsonValue)
      Creates a SecurityCredentials from a JSON.

      Example:

           {
               "name": "jenkins",
               "identifier": "alice",
               "secret": "secret",
               "proxy": {
                   "type": "socket",
                   "address": "192.168.1.250",
                   "port": 8080
               }
           }
       
      Parameters:
      jsonValue - a JSON structure
      Returns:
      the created SecurityCredentials
    • getName

      public java.lang.String getName()
    • getType

      public java.lang.String getType()
    • getIdentifier

      public java.lang.String getIdentifier()
    • getSecret

      public char[] getSecret()
    • getProperties

      public java.util.Map<java.lang.String,java.lang.Object> getProperties()
    • getPropertyStr

      public java.lang.String getPropertyStr(java.lang.String key)
      Returns the property as String.
      Parameters:
      key - Name of the property
      Returns:
      String representation
    • getPropertyChars

      public char[] getPropertyChars(java.lang.String key)
      Returns the property as characters.
      Parameters:
      key - Name of the property
      Returns:
      char[] representation
    • getPropertyBool

      public boolean getPropertyBool(java.lang.String key)
      Returns the property as boolean.
      Parameters:
      key - Name of the property
      Returns:
      boolean representation
    • getPropertyNum

      public java.lang.Number getPropertyNum(java.lang.String key)
      Returns the property as Number.
      Parameters:
      key - Name of the property
      Returns:
      boolean representation
    • getProxy

      public java.net.Proxy getProxy()
    • eraseCredentials

      public void eraseCredentials()
      Description copied from interface: SecurityCredentialsContainer
      Get called, if the secret information should be erased.
      Specified by:
      eraseCredentials in interface SecurityCredentialsContainer
    • equals

      public boolean equals(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object