Class Login

java.lang.Object
com.atlassian.jira.rest.auth.Login

@Path("session") @Consumes("application/json") @Produces("application/json") public class Login extends Object
Implement a REST resource for acquiring a session cookie.
Since:
v4.2
  • Constructor Details

  • Method Details

    • currentUser

      @GET public jakarta.ws.rs.core.Response currentUser() throws URISyntaxException
      Returns information about the currently authenticated user's session. If the caller is not authenticated they will get a 401 Unauthorized status code.
      Returns:
      JSON containing information about the current user
      Throws:
      URISyntaxException - if the self URI is invalid somehow
    • login

      @POST public jakarta.ws.rs.core.Response login(com.atlassian.jira.rest.auth.AuthParams credentials, @Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response)
      Creates a new session for a user in Jira. Once a session has been successfully created it can be used to access any of Jira's remote APIs and also the web UI by passing the appropriate HTTP Cookie header.

      Note that it is generally preferrable to use HTTP BASIC authentication with the REST API. However, this resource may be used to mimic the behaviour of Jira's log-in page (e.g. to display log-in errors to a user).

      Parameters:
      credentials - the username and password to authenticate
      request - injected by Jersey
      response - injected by Jersey
      Returns:
      an AuthSuccess entity
      Throws:
      com.atlassian.seraph.auth.AuthenticatorException - if the DefaultAuthenticator explodes
    • logout

      @DELETE public jakarta.ws.rs.core.Response logout(@Context jakarta.servlet.http.HttpServletRequest request, @Context jakarta.servlet.http.HttpServletResponse response)
      Logs the current user out of Jira, destroying the existing session, if any.
      Parameters:
      request - injected by Jersey
      response - injected by Jersey
      Returns:
      401 if the called is not authenticated. NO_CONTENT if the successful.
    • stampDeniedReasonsOnResponse

      protected void stampDeniedReasonsOnResponse(jakarta.servlet.http.HttpServletResponse response, Set<DeniedReason> deniedReasons)
      Stamps the '"X-Authentication-Denied-Reason"' header on the response object.
      Parameters:
      response - a HttpServletResponse
      deniedReasons - a Set of DeniedReason