org.keycloak.services.resources

## Class AccountService

- java.lang.Object
- - org.keycloak.services.resources.AccountService

-     public class AccountService
      extends Object

  Author:
    Stian Thorgersen

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AccountService.AccountSocialAction`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected javax.ws.rs.core.HttpHeaders` | `headers`
    `static String` | `KEYCLOAK_STATE_CHECKER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AccountService(RealmModel realm, ApplicationModel application, EventBuilder event)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `javax.ws.rs.core.Response` | `accountPage()` Get account information.
    `javax.ws.rs.core.Response` | `accountPreflight()` CORS preflight
    `static javax.ws.rs.core.UriBuilder` | `accountServiceBaseUrl(javax.ws.rs.core.UriBuilder base)`
    `static javax.ws.rs.core.UriBuilder` | `accountServiceBaseUrl(javax.ws.rs.core.UriInfo uriInfo)`
    `protected void` | `csrfCheck(javax.ws.rs.core.MultivaluedMap<String,String> formData)` Check to see if form post has sessionId hidden field and match it against the session id.
    `protected void` | `csrfCheck(String stateChecker)` Check to see if form post has sessionId hidden field and match it against the session id.
    `void` | `init()`
    `static boolean` | `isPasswordSet(UserModel user)`
    `javax.ws.rs.core.Response` | `loginRedirect(String code, String state, String error, String path, String referrer, javax.ws.rs.core.HttpHeaders headers)`
    `static javax.ws.rs.core.UriBuilder` | `loginRedirectUrl(javax.ws.rs.core.UriBuilder base)`
    `javax.ws.rs.core.Response` | `logPage()`
    `javax.ws.rs.core.Response` | `passwordPage()`
    `static javax.ws.rs.core.UriBuilder` | `passwordUrl(javax.ws.rs.core.UriBuilder base)`
    `javax.ws.rs.core.Response` | `processAccountUpdate(javax.ws.rs.core.MultivaluedMap<String,String> formData)` Update account information.
    `javax.ws.rs.core.Response` | `processPasswordUpdate(javax.ws.rs.core.MultivaluedMap<String,String> formData)` Update account password Form params: password - old password password-new pasword-confirm
    `javax.ws.rs.core.Response` | `processSessionsLogout(String stateChecker)`
    `javax.ws.rs.core.Response` | `processSocialUpdate(String action, String providerId, String stateChecker)`
    `javax.ws.rs.core.Response` | `processTotpRemove(String stateChecker)`
    `javax.ws.rs.core.Response` | `processTotpUpdate(javax.ws.rs.core.MultivaluedMap<String,String> formData)` Update the TOTP for this account.
    `void` | `require(String role)`
    `void` | `requireOneOf(String... roles)`
    `javax.ws.rs.core.Response` | `sessionsPage()`
    `protected void` | `setReferrerOnPage()`
    `javax.ws.rs.core.Response` | `socialPage()`
    `static javax.ws.rs.core.UriBuilder` | `socialUrl(javax.ws.rs.core.UriBuilder base)`
    `javax.ws.rs.core.Response` | `totpPage()`
    `static javax.ws.rs.core.UriBuilder` | `totpUrl(javax.ws.rs.core.UriBuilder base)`

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

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

- - ### Field Detail

    - #### KEYCLOAK_STATE_CHECKER

          public static final String KEYCLOAK_STATE_CHECKER

      See Also:
        Constant Field Values

    - #### headers

          @Context
          protected javax.ws.rs.core.HttpHeaders headers

  - ### Constructor Detail

    - #### AccountService

          public AccountService(RealmModel realm,
                        ApplicationModel application,
                        EventBuilder event)

  - ### Method Detail

    - #### init

          public void init()

    - #### accountServiceBaseUrl

          public static javax.ws.rs.core.UriBuilder accountServiceBaseUrl(javax.ws.rs.core.UriInfo uriInfo)

    - #### accountServiceBaseUrl

          public static javax.ws.rs.core.UriBuilder accountServiceBaseUrl(javax.ws.rs.core.UriBuilder base)

    - #### setReferrerOnPage

          protected void setReferrerOnPage()

    - #### accountPreflight

          @Path(value="/")
          @OPTIONS
          public javax.ws.rs.core.Response accountPreflight()

      CORS preflight
      Returns:

    - #### accountPage

          @Path(value="/")
          @GET
          public javax.ws.rs.core.Response accountPage()

      Get account information.
      Returns:

    - #### totpUrl

          public static javax.ws.rs.core.UriBuilder totpUrl(javax.ws.rs.core.UriBuilder base)

    - #### totpPage

          @Path(value="totp")
          @GET
          public javax.ws.rs.core.Response totpPage()

    - #### passwordUrl

          public static javax.ws.rs.core.UriBuilder passwordUrl(javax.ws.rs.core.UriBuilder base)

    - #### passwordPage

          @Path(value="password")
          @GET
          public javax.ws.rs.core.Response passwordPage()

    - #### socialUrl

          public static javax.ws.rs.core.UriBuilder socialUrl(javax.ws.rs.core.UriBuilder base)

    - #### socialPage

          @Path(value="social")
          @GET
          public javax.ws.rs.core.Response socialPage()

    - #### logPage

          @Path(value="log")
          @GET
          public javax.ws.rs.core.Response logPage()

    - #### sessionsPage

          @Path(value="sessions")
          @GET
          public javax.ws.rs.core.Response sessionsPage()

    - #### csrfCheck

          protected void csrfCheck(javax.ws.rs.core.MultivaluedMap<String,String> formData)

      Check to see if form post has sessionId hidden field and match it against the session id.
      Parameters:
        `formData` -

    - #### csrfCheck

          protected void csrfCheck(String stateChecker)

      Check to see if form post has sessionId hidden field and match it against the session id.

    - #### processAccountUpdate

          @Path(value="/")
          @POST
          @Consumes(value="application/x-www-form-urlencoded")
          public javax.ws.rs.core.Response processAccountUpdate(javax.ws.rs.core.MultivaluedMap<String,String> formData)

      Update account information. Form params: firstName lastName email
      Parameters:
        `formData` -
      Returns:

    - #### processTotpRemove

          @Path(value="totp-remove")
          @GET
          public javax.ws.rs.core.Response processTotpRemove(@QueryParam(value="stateChecker")
                                                             String stateChecker)

    - #### processSessionsLogout

          @Path(value="sessions-logout")
          @GET
          public javax.ws.rs.core.Response processSessionsLogout(@QueryParam(value="stateChecker")
                                                                 String stateChecker)

    - #### processTotpUpdate

          @Path(value="totp")
          @POST
          @Consumes(value="application/x-www-form-urlencoded")
          public javax.ws.rs.core.Response processTotpUpdate(javax.ws.rs.core.MultivaluedMap<String,String> formData)

      Update the TOTP for this account. form parameters: totp - otp generated by authenticator totpSecret - totp secret to register
      Parameters:
        `formData` -
      Returns:

    - #### processPasswordUpdate

          @Path(value="password")
          @POST
          @Consumes(value="application/x-www-form-urlencoded")
          public javax.ws.rs.core.Response processPasswordUpdate(javax.ws.rs.core.MultivaluedMap<String,String> formData)

      Update account password Form params: password - old password password-new pasword-confirm
      Parameters:
        `formData` -
      Returns:

    - #### processSocialUpdate

          @Path(value="social-update")
          @GET
          public javax.ws.rs.core.Response processSocialUpdate(@QueryParam(value="action")
                                                               String action,
                                                               @QueryParam(value="provider_id")
                                                               String providerId,
                                                               @QueryParam(value="stateChecker")
                                                               String stateChecker)

    - #### loginRedirectUrl

          public static javax.ws.rs.core.UriBuilder loginRedirectUrl(javax.ws.rs.core.UriBuilder base)

    - #### loginRedirect

          @Path(value="login-redirect")
          @GET
          public javax.ws.rs.core.Response loginRedirect(@QueryParam(value="code")
                                                         String code,
                                                         @QueryParam(value="state")
                                                         String state,
                                                         @QueryParam(value="error")
                                                         String error,
                                                         @QueryParam(value="path")
                                                         String path,
                                                         @QueryParam(value="referrer")
                                                         String referrer,
                                                         @Context
                                                         javax.ws.rs.core.HttpHeaders headers)

    - #### isPasswordSet

          public static boolean isPasswordSet(UserModel user)

    - #### require

          public void require(String role)

    - #### requireOneOf

          public void requireOneOf(String... roles)

Copyright © 2014. All Rights Reserved.