public final class ClientIdentity
extends java.lang.Object
Constructor and Description |
---|
ClientIdentity(ChaincodeStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
assertAttributeValue(java.lang.String attrName,
java.lang.String attrValue)
assertAttributeValue verifies that the invoking identity has the attribute named `attrName`
with a value of `attrValue`.
|
java.lang.String |
getAttributeValue(java.lang.String attrName)
getAttributeValue returns the value of the client's attribute named `attrName`.
|
java.lang.String |
getId()
getId returns the ID associated with the invoking identity.
|
java.lang.String |
getMSPID()
getMSPID returns the MSP ID of the invoking identity.
|
java.security.cert.X509Certificate |
getX509Certificate()
getX509Certificate returns the X509 certificate associated with the invoking identity,
or null if it was not identified by an X509 certificate, for instance if the MSP is
implemented with an alternative to PKI such as [Identity Mixer](https://jira.hyperledger.org/browse/FAB-5673).
|
public ClientIdentity(ChaincodeStub stub) throws java.security.cert.CertificateException, org.json.JSONException, java.io.IOException
java.security.cert.CertificateException
org.json.JSONException
java.io.IOException
public java.lang.String getId()
public java.lang.String getMSPID()
public java.lang.String getAttributeValue(java.lang.String attrName)
attrName
- Name of the attribute to retrieve the value from the
identity's credentials (such as x.509 certificate for PKI-based MSPs).public boolean assertAttributeValue(java.lang.String attrName, java.lang.String attrValue)
attrName
- Name of the attribute to retrieve the value from the
identity's credentials (such as x.509 certificate for PKI-based MSPs)attrValue
- Expected value of the attributepublic java.security.cert.X509Certificate getX509Certificate()