Class SecurityCredentials
- java.lang.Object
-
- net.sourceforge.plantuml.security.authentication.SecurityCredentials
-
- All Implemented Interfaces:
SecurityCredentialsContainer
public class SecurityCredentials extends Object implements SecurityCredentialsContainer
Defines a configuration for credentials.- Author:
- Aljoscha Rittner
-
-
Field Summary
Fields Modifier and Type Field Description static SecurityCredentials
NONE
No credentials given.
-
Constructor Summary
Constructors Constructor Description SecurityCredentials(String name, String type, String identifier, char[] secret)
Creates BasicAuth credentials without a proxy.SecurityCredentials(String name, String type, String identifier, char[] secret, Map<String,Object> properties, Proxy proxy)
Creates BasicAuth credentials with a proxy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SecurityCredentials
basicAuth(String identifier, char[] secret)
Creates BasicAuth credentials.boolean
equals(Object o)
void
eraseCredentials()
Get called, if the secret information should be erased.static SecurityCredentials
fromJson(JsonValue jsonValue)
Creates a SecurityCredentials from a JSON.String
getIdentifier()
String
getName()
Map<String,Object>
getProperties()
boolean
getPropertyBool(String key)
Returns the property as boolean.char[]
getPropertyChars(String key)
Returns the property as characters.Number
getPropertyNum(String key)
Returns the property as Number.String
getPropertyStr(String key)
Returns the property as String.Proxy
getProxy()
char[]
getSecret()
String
getType()
int
hashCode()
-
-
-
Field Detail
-
NONE
public static final SecurityCredentials NONE
No credentials given.
-
-
Constructor Detail
-
SecurityCredentials
public SecurityCredentials(String name, String type, String identifier, char[] secret)
Creates BasicAuth credentials without a proxy.- Parameters:
name
- Name of the credentialstype
- 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(String name, String type, String identifier, char[] secret, Map<String,Object> properties, Proxy proxy)
Creates BasicAuth credentials with a proxy.- Parameters:
name
- Name of the credentialstype
- The type of authentication and access process (e.g. "basicauth" or "oauth2")identifier
- username, clientId, ...secret
- the secret information to authenticate the client or userproxy
- proxy configuration
-
-
Method Detail
-
basicAuth
public static SecurityCredentials basicAuth(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 String getName()
-
getType
public String getType()
-
getIdentifier
public String getIdentifier()
-
getSecret
public char[] getSecret()
-
getPropertyStr
public String getPropertyStr(String key)
Returns the property as String.- Parameters:
key
- Name of the property- Returns:
- String representation
-
getPropertyChars
public char[] getPropertyChars(String key)
Returns the property as characters.- Parameters:
key
- Name of the property- Returns:
- char[] representation
-
getPropertyBool
public boolean getPropertyBool(String key)
Returns the property as boolean.- Parameters:
key
- Name of the property- Returns:
- boolean representation
-
getPropertyNum
public Number getPropertyNum(String key)
Returns the property as Number.- Parameters:
key
- Name of the property- Returns:
- boolean representation
-
getProxy
public Proxy getProxy()
-
eraseCredentials
public void eraseCredentials()
Description copied from interface:SecurityCredentialsContainer
Get called, if the secret information should be erased.- Specified by:
eraseCredentials
in interfaceSecurityCredentialsContainer
-
-