Class LinkedAccountsResource

java.lang.Object
org.keycloak.services.resources.account.LinkedAccountsResource

public class LinkedAccountsResource extends Object
API for linking/unlinking social login accounts
Author:
Stan Silvert
  • Constructor Summary

    Constructors
    Constructor
    Description
    LinkedAccountsResource(org.keycloak.models.KeycloakSession session, org.keycloak.http.HttpRequest request, Auth auth, org.keycloak.events.EventBuilder event, org.keycloak.models.UserModel user)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.ws.rs.core.Response
    buildLinkedAccountURI(String providerAlias, String redirectUri)
    Deprecated.
    It is recommended to trigger linking identity provider account with the use of "idp_link" kc_action.
    List<org.keycloak.representations.account.LinkedAccountRepresentation>
    getLinkedAccounts(org.keycloak.models.KeycloakSession session, org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user)
    Deprecated.
    jakarta.ws.rs.core.Response
    linkedAccounts(Boolean linked, String search, Integer firstResult, Integer maxResults)
    Returns the enabled identity providers the user is currently linked to, or those available for the user to link their account to.When the linked param is true, all providers currently linked to the user are returned in the form of LinkedAccountRepresentation objects, including those associated with organizations.
    jakarta.ws.rs.core.Response
    removeLinkedAccount(String providerAlias)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LinkedAccountsResource

      public LinkedAccountsResource(org.keycloak.models.KeycloakSession session, org.keycloak.http.HttpRequest request, Auth auth, org.keycloak.events.EventBuilder event, org.keycloak.models.UserModel user)
  • Method Details

    • linkedAccounts

      @GET @Path("/") @Produces("application/json") public jakarta.ws.rs.core.Response linkedAccounts(@QueryParam("linked") Boolean linked, @QueryParam("search") String search, @QueryParam("first") Integer firstResult, @QueryParam("max") Integer maxResults)
      Returns the enabled identity providers the user is currently linked to, or those available for the user to link their account to.When the linked param is true, all providers currently linked to the user are returned in the form of LinkedAccountRepresentation objects, including those associated with organizations.

      When the linked param is false, only the identity providers not linked to organizations (i.e. realm level providers) will be returned and be made available for linking.
      Parameters:
      linked - a Boolean indicating whether to return only the linked providers (true) or only the providers available for linking (false).
      search - Filter to search specific providers by name. Search can be prefixed (name*), contains (*name*) or exact (\"name\"). Default prefixed.
      firstResult - Pagination offset.
      maxResults - Maximum results size.
      Returns:
      a set of LinkedAccountRepresentation sorted by the {code guiOrder}.
    • getLinkedAccounts

      @Deprecated public List<org.keycloak.representations.account.LinkedAccountRepresentation> getLinkedAccounts(org.keycloak.models.KeycloakSession session, org.keycloak.models.RealmModel realm, org.keycloak.models.UserModel user)
      Deprecated.
    • buildLinkedAccountURI

      @GET @Path("/{providerAlias}") @Produces("application/json") @Deprecated public jakarta.ws.rs.core.Response buildLinkedAccountURI(@PathParam("providerAlias") String providerAlias, @QueryParam("redirectUri") String redirectUri)
      Deprecated.
      It is recommended to trigger linking identity provider account with the use of "idp_link" kc_action.
      Creating URL, which can be used to redirect to link identity provider with currently authenticated user
      Returns:
      response
    • removeLinkedAccount

      @DELETE @Path("/{providerAlias}") @Produces("application/json") public jakarta.ws.rs.core.Response removeLinkedAccount(@PathParam("providerAlias") String providerAlias)