Interface AuthApi


  • @Path("/_matrix/client/r0")
    @Consumes("application/json")
    @Produces("application/json")
    public interface AuthApi
    A client can obtain access tokens using the /login API.
    Note that this endpoint does not currently use the user-interactive authentication API.
    • Method Summary

      Modifier and Type Method Description
      void login​(LoginRequest loginRequest, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse)
      Authenticates the user, and issues an access token they can use to authorize themself in subsequent requests.
      void logout​(javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      Invalidates an existing access token, so that it can no longer be used for authorization.
      void logoutAll​(javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      Invalidates all access tokens for a user, so that they can no longer be used for authorization.
      void supportedLoginTypes​(javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse)
      Gets the homeserver's supported login types to authenticate users.
    • Method Detail

      • supportedLoginTypes

        @GET
        @Path("/login")
        void supportedLoginTypes​(@Context
                                 javax.ws.rs.core.UriInfo uriInfo,
                                 @Context
                                 javax.ws.rs.core.HttpHeaders httpHeaders,
                                 @Suspended
                                 javax.ws.rs.container.AsyncResponse asyncResponse)
        Gets the homeserver's supported login types to authenticate users. Clients should pick one of these and supply it as the type when logging in.
        Rate-limited: Yes.
        Return: SupportedLoginResponse.

        Status code 200: The login types the homeserver supports.

        Status code 429: This request was rate-limited.

        Parameters:
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
      • login

        @POST
        @Path("/login")
        void login​(LoginRequest loginRequest,
                   @Context
                   javax.ws.rs.core.UriInfo uriInfo,
                   @Context
                   javax.ws.rs.core.HttpHeaders httpHeaders,
                   @Suspended
                   javax.ws.rs.container.AsyncResponse asyncResponse)
        Authenticates the user, and issues an access token they can use to authorize themself in subsequent requests.
        If the client does not supply a device_id, the server must auto-generate one.
        The returned access token must be associated with the device_id supplied by the client or generated by the server. The server may invalidate any access token previously associated with that device.
        Rate-limited: Yes.
        Return: LoginResponse.

        Status code 200: The user has been authenticated.

        Status code 400: Part of the request was invalid. For example, the login type may not be recognised.

        Status code 401: The login attempt failed. For example, the password may have been incorrect.

        Status code 429: This request was rate-limited.

        Parameters:
        loginRequest - JSON body request.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
      • logout

        @POST
        @Path("/logout")
        void logout​(@Context
                    javax.ws.rs.core.UriInfo uriInfo,
                    @Context
                    javax.ws.rs.core.HttpHeaders httpHeaders,
                    @Suspended
                    javax.ws.rs.container.AsyncResponse asyncResponse,
                    @Context
                    javax.ws.rs.core.SecurityContext securityContext)
        Invalidates an existing access token, so that it can no longer be used for authorization.
        Requires auth: Yes.
        The access token used in the request was successfully invalidated.
        Return: EmptyResponse.

        Status code 200: The access token used in the request was succesfully invalidated.

        Parameters:
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • logoutAll

        @POST
        @Path("/logout/all")
        void logoutAll​(@Context
                       javax.ws.rs.core.UriInfo uriInfo,
                       @Context
                       javax.ws.rs.core.HttpHeaders httpHeaders,
                       @Suspended
                       javax.ws.rs.container.AsyncResponse asyncResponse,
                       @Context
                       javax.ws.rs.core.SecurityContext securityContext)
        Invalidates all access tokens for a user, so that they can no longer be used for authorization. This includes the access token that made this request.
        This endpoint does not require UI authorization because UI authorization is designed to protect against attacks where the someone gets hold of a single access token then takes over the account. This endpoint invalidates all access tokens for the user, including the token used in the request, and therefore the attacker is unable to take over the account in this way.
        Requires auth: Yes.
        Return: EmptyResponse.

        Status code 200: The user's access tokens were succesfully invalidated.

        Parameters:
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.