Package com.atlassian.jira.rest.auth
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 Summary
ConstructorsConstructorDescriptionLogin(LoginService loginService, JiraAuthenticationContext jiraAuthenticationContext, JiraBaseUrls jiraBaseUrls, I18nHelper i18n, FeatureManager featureManager) -
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.ResponseReturns information about the currently authenticated user's session.jakarta.ws.rs.core.Responselogin(com.atlassian.jira.rest.auth.AuthParams credentials, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Creates a new session for a user in Jira.jakarta.ws.rs.core.Responselogout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Logs the current user out of Jira, destroying the existing session, if any.protected voidstampDeniedReasonsOnResponse(jakarta.servlet.http.HttpServletResponse response, Set<DeniedReason> deniedReasons) Stamps the '"X-Authentication-Denied-Reason"' header on the response object.
-
Constructor Details
-
Login
@Inject public Login(LoginService loginService, JiraAuthenticationContext jiraAuthenticationContext, JiraBaseUrls jiraBaseUrls, I18nHelper i18n, FeatureManager featureManager)
-
-
Method Details
-
currentUser
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 authenticaterequest- injected by Jerseyresponse- 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 Jerseyresponse- 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 HttpServletResponsedeniedReasons- a Set of DeniedReason
-