org.keycloak.services.resources.account

## Class AccountCredentialResource

- java.lang.Object
- - org.keycloak.services.resources.account.AccountCredentialResource

-     public class AccountCredentialResource
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AccountCredentialResource.CredentialContainer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ENABLED_ONLY`
    `static String` | `TYPE`
    `static String` | `USER_CREDENTIALS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AccountCredentialResource(KeycloakSession session, UserModel user, Auth auth)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Stream<AccountCredentialResource.CredentialContainer>` | `credentialTypes(String type, Boolean userCredentials)` Retrieve the stream of credentials available to the current logged in user.
    `void` | `removeCredential(String credentialId)` Remove a credential of current user
    `void` | `setLabel(String credentialId, String userLabel)` Update a user label of specified credential of current user

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

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

- - ### Field Detail

    - #### TYPE

          public static final String TYPE

      See Also:
        Constant Field Values

    - #### ENABLED_ONLY

          public static final String ENABLED_ONLY

      See Also:
        Constant Field Values

    - #### USER_CREDENTIALS

          public static final String USER_CREDENTIALS

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AccountCredentialResource

          public AccountCredentialResource(KeycloakSession session,
                                           UserModel user,
                                           Auth auth)

  - ### Method Detail

    - #### credentialTypes

          @GET
           @Produces(value="application/json")
          public Stream<AccountCredentialResource.CredentialContainer> credentialTypes(@QueryParam(value="type")
                                                                                                                                 String type,
                                                                                                                                 @QueryParam(value="user-credentials")
                                                                                                                                 Boolean userCredentials)

      Retrieve the stream of credentials available to the current logged in user. It will return only credentials of enabled types, which user can use to authenticate in some authentication flow.
      Parameters:
        `type` - Allows to filter just single credential type, which will be specified as this parameter. If null, it will return all credential types
        `userCredentials` - specifies if user credentials should be returned. If true, they will be returned in the "userCredentials" attribute of particular credential. Defaults to true.
      Returns:

    - #### removeCredential

          @Path(value="{credentialId}")
           @DELETE
          public void removeCredential(@PathParam(value="credentialId")
                                                                              String credentialId)

      Remove a credential of current user
      Parameters:
        `credentialId` - ID of the credential, which will be removed

    - #### setLabel

          @PUT
           @Consumes(value="application/json")
           @Path(value="{credentialId}/label")
          public void setLabel(@PathParam(value="credentialId")
                                                                                                              String credentialId,
                                                                                                              String userLabel)

      Update a user label of specified credential of current user
      Parameters:
        `credentialId` - ID of the credential, which will be updated
        `userLabel` - new user label as JSON string

Copyright © 2020 JBoss by Red Hat. All rights reserved.