# Asset Level Credentials

5\. The Asset Level Credentials screen is displayed. This screen allows you to define the access rules at the asset level. For a better understanding of how access credentials work, please check this <mark style="color:red;">link</mark>.

6\. The **Access Rules** group is displayed. Using the fields in this group, you can decide who is allowed or denied access to the asset. The rules are based on web3 addresses.

7\. The "**Allow ETH Address"** option enables the user to define  who can access the asset:&#x20;

* To grant access to everybody, select "*Allow all addresses*"

<figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2Flevoca9PmrfCKnBu9Pmb%2Fimage.png?alt=media&#x26;token=fb753cee-2620-4e90-b1de-b18c890f25a5" alt=""><figcaption></figcaption></figure>

* To restrict access to specific users, select "*Allow specific addresses*".&#x20;
  * A text field is displayed. Enter the web3 address and press *Add new address*. You can add multiple addresses.&#x20;

<figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FOI2knrp8P0pU4vwFFqZo%2Fimage.png?alt=media&#x26;token=32fc0baf-9499-4cce-8de8-08a6d0be29f0" alt=""><figcaption></figcaption></figure>

8\. The "**Deny ETH Address"** option enables the user to define  who is denied access to the asset:&#x20;

* To deny access to everybody, select "*Deny all addresses*"

<figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FIDJMucujWLFBVO3PiIzY%2Fimage.png?alt=media&#x26;token=201d8a01-732a-4bdd-a547-0e3992f6c7c4" alt=""><figcaption></figcaption></figure>

* To deny access to specific addresses, select *"Deny specific addresses"*.
  * A text field is displayed. Enter the web3 address and press *Add new address*. You can add multiple addresses.

<figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2F4AweqdXNrOvS7iLf9w3D%2Fimage.png?alt=media&#x26;token=7efc707a-81cf-47a8-8ef7-dbc7631796c6" alt=""><figcaption></figcaption></figure>

**Note:** <mark style="color:$info;background-color:$info;">Selecting both "Allow all addresses" and "Deny all addresses" simultaneously will result in access being denied to all users, as the deny list takes precedence.</mark>

9\. To enable access rules based on SSI credentials, select the "Enable SSI Policies" checkbox. The SSI Policies group is displayed.

<figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FATKjcyOsgZoRfcXy9t2Y%2Fimage.png?alt=media&#x26;token=a56549ba-5f7a-4f19-8b8d-3fe638cc35cf" alt=""><figcaption></figcaption></figure>

Using this user interface, the publisher can define access rules at the asset level based on the Verifiable Credentials (VCs) owned by the consumer in their SSI wallet. The VC-based access rules are referred to as SSI policies or simply policies. Three types of SSI policies can be defined:

* **Policies applied to all requested VCs (static policies)**: their scope includes all requested VCs. The following static policies can be applied:

  * *signature*: verifies the signature of the VC
  * *not-before*: verifies the credential is not used before its validity time
  * *revoked-status-list*: verifies that the credential was not&#x20;
  * *expired*: Verifies that the credential has not expired
  * signature\_sd-jwt-vc: verifies the signature for the selective disclosure JWT (SD-JWT) type of VCs.

  <mark style="color:$info;background-color:$info;">**Note**</mark><mark style="color:$info;background-color:$info;">: by default, certain policies are enforced by the marketplace and are  preselected. Additionally, the component that evaluates the submitted VCs applies a set of predefined policies automatically. Therefore, even if you manually deselect a default policy, it may still be enforced due to underlying system rules.</mark>
* **Policies applied to a specific VC**: applicable only to the VC for which they were defined. The following policies can be applied to the VC level:
  * *Static policies* (see the list above)
  * &#x20;*Allowed issuer:* verifies that the VC was issued by a list of specific entities defined by their DIDs. If the VC was not issued by any of the DIDs in the list, the policy fails
  * *Custom policy:*  verification rules based on the fields within the requested VCs. For instance, the publisher can enforce a rule that only legal entities from Germany can access the asset. This policy verifies that the `credentialSubject.gx:headquartersAddress.gx:countryCode` equals `"DE"`.
  * *Custom URL policy*: A custom policy authored in the REGO language and hosted at a designated URL. This approach enables advanced verification scenarios by allowing tailored logic based on the specific fields within the requested Verifiable Credentials (VCs).
* **Advanced policies:** applicable to all VCs. The following advanced policies can be applied:

  * *Credential presenter same as credential owner:* verifies that the entity that issues the verifiable presentation (VP) that embeds the VC is the same as the subject of the VC. In case the entity that submits the VP for verification is not the subject of the VC, the policy fails.&#x20;
  * *All requested credential types are necessary for verification:* verifies that all requested VCs are submitted for verification. If this policy is not enabled and the access rules to the asset request, for instance, two VCs - LegalPerson and LegalRegistrationNumber - a consumer who submits just one of the of these credentials passes the verification. With the policy enabled, passing just one of the credentials will result in failure. &#x20;
  * *Minimum number of credentials required*: Set the minimum number of credentials that must be presented for successful verification. Presenting less VCs than the minimum number of credentials will result in failure.&#x20;
  * *Maximum number of credentials required*: Set the maximum number of credentials that must be presented for successful verification.

  <mark style="color:$info;background-color:$info;">**Note**</mark><mark style="color:$info;background-color:$info;">: some of the advanced policies are enforced by default by the marketplace and are checked in the user interface.</mark>

10\. **Policies applied to all credentials:** To add a new policy applied to all credentials, mark the corresponding checkbox.

<figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2Fx331K57uprwUw3rMEdVX%2Fimage.png?alt=media&#x26;token=b0cc8647-d8a2-4182-8d9e-3242799531da" alt=""><figcaption></figcaption></figure>

11\. **Policies applied to a specific VC**: To define policies applicable to a particular VC, perform the following steps:&#x20;

* Click the **New Credential Request** button. The **Credential Request #1** group is displayed.

<figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FCcFibS1RKgYd8A2QRjT7%2Fimage.png?alt=media&#x26;token=0a5831fb-ddcd-499b-89d2-a5dccbd15566" alt=""><figcaption></figcaption></figure>

* From the **Type** list, select the VC you want to be requested. The list of supported VCs will be periodically updated. Please consult <mark style="color:red;">here</mark> the list of supported VCs.  \
  From the **Format** list, select the format in which the VC should be presented: `jwt_vc_json`, `mso_mdoc` or `vc+sd_jwt`.&#x20;

<figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FFgF7Uq8UjBM1doq4eu0e%2Fimage.png?alt=media&#x26;token=4794ab20-aa46-469e-9b34-bcfb20803015" alt=""><figcaption></figcaption></figure>

* To apply a static policy to the requested VC, perform the following:

  * click on **Add policy** button and from the list select **Static Policy**.

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FAo4Id7utwZrr7H1AyEsF%2Fimage.png?alt=media&#x26;token=8155a18f-0fb3-4900-b8f3-26b0a187eb06" alt=""><figcaption></figcaption></figure>

  * The **Static Policy** list is displayed. Select a static policy from the list.

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FC7RWY1AKV06SsmeZbBdl%2Fimage.png?alt=media&#x26;token=8d77f2b1-f9bf-4f7e-b98a-e3df5ac3ea33" alt=""><figcaption></figcaption></figure>

* To apply the Allowed issuer policy to the requested VC, perform the following:

  * click on **Add policy** button and from the list select **Allowed Issuer**.

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2Fuh33mb7ldl4HstLNyqMM%2Fimage.png?alt=media&#x26;token=bcfefad2-3e9f-499a-a6c3-e4399590b57f" alt=""><figcaption></figcaption></figure>

  * The allowed-issuer policy is diplayed. Press the **New Issuer DID** button and in the **Issuer DID** field enter the DID of the issuer. You can add multiple entries by pressing the **New Issuer DID** button.

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FWOfRoxLLxAglCzA6haVg%2Fimage.png?alt=media&#x26;token=792bed29-b80b-48c0-a75f-0da25678695f" alt=""><figcaption></figcaption></figure>

* To apply a custom policy to the requested VC, perform the following:

  * click on **Add policy** button and from the list select **Custom Policy**.

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2F8C2CLLvwdFAJzEtKn9O3%2Fimage.png?alt=media&#x26;token=4bca006e-3fec-4392-8997-d790b63c5a3a" alt=""><figcaption></figcaption></figure>

  * The **Name** field is displayed. Enter a meaningful name for the custom policy, using letters and numbers. \
    For consistency and readability, it's recommended to use camelCase notation when naming your policy.

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2F6eWpDnm8ZFJg3wn0Pca8%2Fimage.png?alt=media&#x26;token=f093aaf1-30f7-418c-b1db-294b7dd1f787" alt=""><figcaption></figcaption></figure>

  * To create a new rule, click the **New rule** button. From the **Credential field** list, choose a field from the selected VC that you want to evaluate. \
    Next, select the appropriate operator from the **Operator** list.    \
    Finally, enter the desired value in the **Value** field.. Please note that for strings, the comparison is case-insensitive (e.g. "DE", "de" and "De" have the same value).\
    You can add multiple rules in the same custom policy.

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2Fc5ijopRlhAB9BjXOEs9M%2Fimage.png?alt=media&#x26;token=f74a0f71-732f-4cbe-ab56-8e4eaf38bcdc" alt=""><figcaption></figcaption></figure>

* To apply a custom policy available at a URL, perform the following:

  * click on **Add policy** button and from the list select **Custom URL Policy**.<br>

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FEFMtWEENZePQ8C82W7Tp%2Fimage.png?alt=media&#x26;token=e6f92e67-98ed-44e7-823e-667e566575a7" alt=""><figcaption></figcaption></figure>

  * The UI group for Custom URL policies is displayed. When using custom URL policies, ensure you follow these <mark style="color:red;">guidelines</mark>; otherwise, they will not work.

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2F3fjGLzRnodkjkL3pXuU6%2Fimage.png?alt=media&#x26;token=6c0e3baf-7432-472b-867a-e7239a44c5f8" alt=""><figcaption></figcaption></figure>

  * Enter the policy name in the **Custom URL Policy Name** text field

  * Enter the URL where the policy is located in the **Policy URL** text field

  * If the custom policy needs arguments to run, to add them, click on the **New argument** button

  * Add the parameter name in the **Parameter Name** field and its value in the **Value** field. You can add multiple parameters.

    <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2F67yYk5w82E1Uk0mkAcmO%2Fimage.png?alt=media&#x26;token=1623c299-b365-4ce0-a0cc-1ae1e229a23a" alt=""><figcaption></figcaption></figure>

12\. **Advanced Policies.** To set up advanced features related to how the verification of the presented VC is done, perform the following steps:

* Select the **Edit Advanced Policy Features** checkbox. The **Advanced SSI Policy Features** group is displayed.

  <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2F0GieUhlVU7kYQcaB4tRm%2Fimage.png?alt=media&#x26;token=5b8d8773-6731-426c-b5a5-512cfb6bf410" alt=""><figcaption></figcaption></figure>
* Some advanced features are selected by default when the group is displayed.
* Please select the policies relevant to your case. For both the minimum and maximum number of credentials required, enter a numerical value as illustrated below.

  <figure><img src="https://1789397093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH0zpgrXbeZ7u6UuCV9Gz%2Fuploads%2FMLqMcHsWXGfzsSX4yAHg%2Fimage.png?alt=media&#x26;token=94b63295-5527-4e0e-82c6-0e803d6415a6" alt=""><figcaption></figcaption></figure>

<mark style="color:$info;background-color:$info;">**Note**</mark><mark style="color:$info;background-color:$info;">: Ensure you understand the function of the advanced policies and how they impact the verification process of VCs for the respective asset.</mark>

13\. Press the **Continue** button.&#x20;
