Package org.opensaml.security.credential

# Class AbstractCredential

java.lang.Object
org.opensaml.security.credential.AbstractCredential

All Implemented Interfaces:
  `Credential`

Direct Known Subclasses:
  `BasicCredential`, `KeyStoreX509CredentialAdapter`, `ServletRequestX509CredentialAdapter`, `X509KeyManagerX509CredentialAdapter`

public abstract class AbstractCredential extends Object implements Credential
Base class for `Credential` implementations.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final CredentialContextSet`
`credentialContextSet`
Credential context of this credential.
`private String`
`entityId`
ID of the entity owning this credential.
`private Collection<String>`
`keyNames`
Key names for this credential.
`private PrivateKey`
`privateKey`
Private key of this credential.
`private PublicKey`
`publicKey`
Public key of this credential.
`private SecretKey`
`secretKey`
Secret key for this credential.
`private UsageType`
`usageType`
Usage type of this credential.

## Constructor Summary

Constructors
Constructor
Description
`AbstractCredential()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`CredentialContextSet`
`getCredentialContextSet()`
Get the set of credential context information, which provides additional information specific to the contexts in which the credential was resolved.
`String`
`getEntityId()`
The unique ID of the entity this credential is for.
`Collection<String>`
`getKeyNames()`
Gets key names for this credential.
`PrivateKey`
`getPrivateKey()`
Gets the private key for the entity if there is one.
`PublicKey`
`getPublicKey()`
Gets the public key for the entity.
`SecretKey`
`getSecretKey()`
Gets the secret key for this entity.
`UsageType`
`getUsageType()`
Gets usage type of this credential.
`protected void`
`setEntityId(String newEntityID)`
Sets the ID of the entity this credential is for.
`protected void`
`setPrivateKey(PrivateKey newPrivateKey)`
Sets the private key for this credential.
`protected void`
`setPublicKey(PublicKey newPublicKey)`
Sets the public key for this credential.
`protected void`
`setSecretKey(SecretKey newSecretKey)`
Sets the secret key for this credential.
`protected void`
`setUsageType(UsageType newUsageType)`
Sets the usage type for this credential.

### Methods inherited from class java.lang.Object

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

### Methods inherited from interface org.opensaml.security.credential.Credential

`getCredentialType`

## Field Details

### entityId

@Nullable private String entityId
ID of the entity owning this credential.

### usageType

@Nullable private UsageType usageType
Usage type of this credential.

### keyNames

@Nonnull private Collection<String> keyNames
Key names for this credential.

### publicKey

@Nullable private PublicKey publicKey
Public key of this credential.

### secretKey

@Nullable private SecretKey secretKey
Secret key for this credential.

### privateKey

@Nullable private PrivateKey privateKey
Private key of this credential.

### credentialContextSet

@Nonnull private final CredentialContextSet credentialContextSet
Credential context of this credential.

## Constructor Details

### AbstractCredential

public AbstractCredential()
Constructor.

## Method Details

### getEntityId

@Nullable public String getEntityId()
The unique ID of the entity this credential is for.

Specified by:
  `getEntityId` in interface `Credential`
Returns:
  unique ID of the entity this credential is for

### getUsageType

@Nullable public UsageType getUsageType()
Gets usage type of this credential.

Specified by:
  `getUsageType` in interface `Credential`
Returns:
  usage type of this credential

### getKeyNames

@Nonnull public Collection<String> getKeyNames()
Gets key names for this credential. These names may be used to reference a key(s) exchanged through an out-of-band agreement. Implementations may or may not implement means to resolve these names into keys retrievable through the `Credential.getPublicKey()`, `Credential.getPrivateKey()` or `Credential.getSecretKey()` methods.

Specified by:
  `getKeyNames` in interface `Credential`
Returns:
  key names for this credential

### getPublicKey

@Nullable public PublicKey getPublicKey()
Gets the public key for the entity.

Specified by:
  `getPublicKey` in interface `Credential`
Returns:
  public key for the entity

### getSecretKey

@Nullable public SecretKey getSecretKey()
Gets the secret key for this entity.

Specified by:
  `getSecretKey` in interface `Credential`
Returns:
  secret key for this entity

### getPrivateKey

@Nullable public PrivateKey getPrivateKey()
Gets the private key for the entity if there is one.

Specified by:
  `getPrivateKey` in interface `Credential`
Returns:
  the private key for the entity

### getCredentialContextSet

@Nonnull public CredentialContextSet getCredentialContextSet()
Get the set of credential context information, which provides additional information specific to the contexts in which the credential was resolved.

Specified by:
  `getCredentialContextSet` in interface `Credential`
Returns:
  set of resolution contexts of the credential

### setEntityId

protected void setEntityId(@Nullable String newEntityID)
Sets the ID of the entity this credential is for.

Parameters:
  `newEntityID` - ID of the entity this credential is for

### setUsageType

protected void setUsageType(@Nonnull UsageType newUsageType)
Sets the usage type for this credential.

Parameters:
  `newUsageType` - usage type for this credential

### setPublicKey

protected void setPublicKey(@Nonnull PublicKey newPublicKey)
Sets the public key for this credential.

Parameters:
  `newPublicKey` - public key for this credential

### setPrivateKey

protected void setPrivateKey(@Nonnull PrivateKey newPrivateKey)
Sets the private key for this credential.

Parameters:
  `newPrivateKey` - private key for this credential

### setSecretKey

protected void setSecretKey(@Nonnull SecretKey newSecretKey)
Sets the secret key for this credential.

Parameters:
  `newSecretKey` - secret key for this credential