Package org.opensaml.security.credential
Class BasicCredential
- java.lang.Object
-
- org.opensaml.security.credential.AbstractCredential
-
- org.opensaml.security.credential.BasicCredential
-
- All Implemented Interfaces:
Credential
,MutableCredential
- Direct Known Subclasses:
BasicX509Credential
public class BasicCredential extends AbstractCredential implements MutableCredential
A basic implementation ofCredential
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BasicCredential()
Constructor.BasicCredential(PublicKey publicKey)
Constructor.BasicCredential(PublicKey publicKey, PrivateKey privateKey)
Constructor.BasicCredential(SecretKey secretKey)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<? extends Credential>
getCredentialType()
Get the primary type of the credential instance.void
setEntityId(String newEntityId)
Sets the ID of the entity this credential is for.void
setPrivateKey(PrivateKey newPrivateKey)
Sets the private key for this credential.void
setPublicKey(PublicKey newPublicKey)
Sets the public key for this credential.void
setSecretKey(SecretKey newSecretKey)
Sets the secret key for this credential.void
setUsageType(UsageType newUsageType)
Sets the usage type for this credential.-
Methods inherited from class org.opensaml.security.credential.AbstractCredential
getCredentialContextSet, getEntityId, getKeyNames, getPrivateKey, getPublicKey, getSecretKey, getUsageType
-
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
getCredentialContextSet, getEntityId, getKeyNames, getPrivateKey, getPublicKey, getSecretKey, getUsageType
-
-
-
-
Constructor Detail
-
BasicCredential
public BasicCredential(@Nonnull PublicKey publicKey)
Constructor.- Parameters:
publicKey
- the credential public key
-
BasicCredential
public BasicCredential(@Nonnull PublicKey publicKey, @Nullable PrivateKey privateKey)
Constructor.- Parameters:
publicKey
- the credential public keyprivateKey
- the credential private key
-
BasicCredential
public BasicCredential(@Nonnull SecretKey secretKey)
Constructor.- Parameters:
secretKey
- the credential secret key
-
BasicCredential
protected BasicCredential()
Constructor.
-
-
Method Detail
-
getCredentialType
public Class<? extends Credential> getCredentialType()
Get the primary type of the credential instance. This will usually be the primary sub-interface ofCredential
implemented by an implementation.- Specified by:
getCredentialType
in interfaceCredential
- Returns:
- the credential type
-
setEntityId
public void setEntityId(@Nullable String newEntityId)
Sets the ID of the entity this credential is for.- Specified by:
setEntityId
in interfaceMutableCredential
- Overrides:
setEntityId
in classAbstractCredential
- Parameters:
newEntityId
- ID of the entity this credential is for
-
setUsageType
public void setUsageType(@Nonnull UsageType newUsageType)
Sets the usage type for this credential.- Specified by:
setUsageType
in interfaceMutableCredential
- Overrides:
setUsageType
in classAbstractCredential
- Parameters:
newUsageType
- usage type for this credential
-
setPublicKey
public void setPublicKey(@Nonnull PublicKey newPublicKey)
Sets the public key for this credential.- Specified by:
setPublicKey
in interfaceMutableCredential
- Overrides:
setPublicKey
in classAbstractCredential
- Parameters:
newPublicKey
- public key for this credential
-
setPrivateKey
public void setPrivateKey(@Nonnull PrivateKey newPrivateKey)
Sets the private key for this credential.- Specified by:
setPrivateKey
in interfaceMutableCredential
- Overrides:
setPrivateKey
in classAbstractCredential
- Parameters:
newPrivateKey
- private key for this credential
-
setSecretKey
public void setSecretKey(@Nonnull SecretKey newSecretKey)
Sets the secret key for this credential.- Specified by:
setSecretKey
in interfaceMutableCredential
- Overrides:
setSecretKey
in classAbstractCredential
- Parameters:
newSecretKey
- secret key for this credential
-
-