Registering a user

These steps are informational only and cannot be executed. For more information you can refer to the GitHub repository https://github.com/HyperledgerHandsOn/trade-finance-logistics/blob/master/chaincode/abac.md 

Let's now register a user with a custom attribute named importer and the value true. Note that the value of the attribute can be of any type and is not limited to Boolean values, as shown in the following snippet:

fabric-ca-client register --id.name user1 --id.secret pwd1 --id.type user --id.affiliation ImporterOrgMSP --id.attrs 'importer=true:ecert'

The previous snippet shows us the command line when registering a user with the attribute importer=true. Note that the values of id.secret and other arguments depend on the Fabric CA configuration.

The preceding command can also define multiple default attributes at once, such as: --id.attrs and importer=true:ecert,[email protected].

The following table contains the default attributes used during user registration:

Attribute name Command line argument Attribute value
hf.EnrollmentID (automatic) The enrollment ID of the identity
hf.Type  id.type  The type of the identity
hf.Affiliation  id.affiliation  The affiliation of the identity

 

If any of the previous attributes are needed in ecert, they must be first defined in the user registration command. For example, the following command registers user1 with the attribute hf.Affiliation=ImporterOrgMSP, which will be copied into ecert by default:

fabric-ca-client register --id.name user1 --id.secret pwd1 --id.type user --id.affiliation ImporterOrgMSP --id.attrs 'importer=true:ecert,hf.Affiliation=ImporterOrgMSP:ecert'
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset