Tabnine Logo
com.atlassian.sal.api.auth
Code IndexAdd Tabnine to your IDE (free)

How to use com.atlassian.sal.api.auth

Best Java code snippets using com.atlassian.sal.api.auth (Showing top 20 results out of 315)

origin: com.atlassian.jwt/jwt-plugin

private boolean authenticationNotAttempted(HttpServletRequest request, HttpServletResponse response)
{
  authenticationListener.authenticationNotAttempted(request, response);
  return true;
}
origin: com.atlassian.plugins/atlassian-connect-core

private void fail(HttpServletRequest request, HttpServletResponse response, String externallyVisibleMessage, int httpResponseCode) {
  sendErrorResponse(response, httpResponseCode, externallyVisibleMessage);
  authenticationListener.authenticationFailure(new Authenticator.Result.Failure(createMessage("")), request, response);
}
origin: com.atlassian.oauth/atlassian-oauth-service-provider-plugin

private boolean mayProceed(HttpServletRequest request, HttpServletResponse response, OAuthRequestVerifier verifier) {
  if (!authenticationController.shouldAttemptAuthentication(request)) {
    authenticationListener.authenticationNotAttempted(request, response);
    return true;
    authenticationListener.authenticationNotAttempted(request, response);
    return true;
  final Authenticator.Result result = authenticator.authenticate(request, response);
  if (result.getStatus() == Authenticator.Result.Status.FAILED) {
    authenticationListener.authenticationFailure(result, request, response);
    OAuthProblemUtils.logOAuthRequest(request, "OAuth authentication FAILED.", LOG);
    return false;
  if (result.getStatus() == Authenticator.Result.Status.ERROR) {
    authenticationListener.authenticationError(result, request, response);
    OAuthProblemUtils.logOAuthRequest(request, "OAuth authentication ERRORED.", LOG);
    return false;
  authenticationListener.authenticationSuccess(result, request, response);
  verifier.setVerified(true);
  OAuthProblemUtils.logOAuthRequest(request, "OAuth authentication successful. Thread marked as Verified.", LOG);
origin: com.atlassian.plugins/atlassian-connect-server-core

private void actAsAddonUser(FilterChain filterChain, HttpServletRequest request, HttpServletResponse response, String addonKey) throws IOException, ServletException {
  try {
    final Principal principal = getPrincipal(addonKey);
    final Authenticator.Result authenticationResult = new Authenticator.Result.Success(createMessage("Successful two-legged-auth"), principal);
    authenticationListener.authenticationSuccess(authenticationResult, request, response);
    filterChain.doFilter(request, response);
  } catch (InvalidSubjectException e) {
    createAndSendFailure(e, response, HttpServletResponse.SC_UNAUTHORIZED, badCredentialsMessage);
  }
}
origin: com.atlassian.oauth/atlassian-oauth-service-provider-plugin

private Result getUserLoginResult(HttpServletRequest request, HttpServletResponse response, OAuthMessage message, Consumer consumer, Principal user) {
  // if a user is provided, they must exist and be able to login
  if (user != null && !authenticationController.canLogin(user, request)) {
    LOG.info("Access denied because user:'{}' cannot login", user.getName());
    sendError(response, HttpServletResponse.SC_UNAUTHORIZED, message);
    return new Result.Failure(new OAuthProblem.PermissionDenied(user.getName()));
  }
  LOG.info("Authenticated app '{}' as user '{}' successfully", consumer.getKey(), user == null ? "null" : user.getName());
  return new Result.Success(user);
}
origin: com.atlassian.jwt/jwt-plugin

@Override
public Result success(String message, Principal principal, Jwt authenticatedJwt)
{
  return new Result.Success(createMessage(message), principal);
}
origin: com.atlassian.plugins/atlassian-connect-server-core

private static Authenticator.Result.Failure createAndSendFailure(Exception e, HttpServletResponse response, int httpResponseCode, String externallyVisibleMessage) {
  log.debug("Failure during JWT authentication: ", e);
  sendErrorResponse(response, httpResponseCode, externallyVisibleMessage);
  return new Authenticator.Result.Failure(createMessage(e.getLocalizedMessage()));
}
origin: com.atlassian.jwt/jwt-plugin

private static Result.Error createAndSendError(Exception e, HttpServletResponse response, int httpResponseCode, String externallyVisibleMessage)
{
  log.debug("Error during JWT authentication: ", e);
  sendErrorResponse(response, httpResponseCode, externallyVisibleMessage);
  return new Result.Error(createMessage(e.getLocalizedMessage()));
}
origin: com.atlassian.sal/sal-fisheye-plugin

public void authenticationSuccess(Authenticator.Result result, HttpServletRequest request, HttpServletResponse response)
{
  String name = result.getPrincipal().getName();
  uma.loginUserForThisRequest(name, request);
}
origin: com.atlassian.plugins/atlassian-connect-server-core

private static void sendErrorResponse(HttpServletResponse response, int httpResponseCode,
                   Result result) {
  String externallyVisibleMessage = result.getMessage();
  response.reset();
  try {
    response.sendError(httpResponseCode, externallyVisibleMessage);
  } catch (IOException doubleFacePalm) {
    log.error("Encountered IOException while trying to report an authentication failure.", doubleFacePalm);
    response.reset();
    response.setStatus(httpResponseCode); // no error message, but hopefully the response code will still be useful
  }
}
origin: com.atlassian.jwt/jwt-plugin

private boolean mayProceed(HttpServletRequest request, HttpServletResponse response)
  if (!authenticationController.shouldAttemptAuthentication(request))
  final Authenticator.Result result = authenticator.authenticate(request, response);
  if (result.getStatus() == Authenticator.Result.Status.FAILED)
    authenticationListener.authenticationFailure(result, request, response);
    return false;
  if (result.getStatus() == Authenticator.Result.Status.ERROR)
    authenticationListener.authenticationError(result, request, response);
    return false;
  authenticationListener.authenticationNotAttempted(request, response);
  return true;
origin: com.atlassian.plugins/atlassian-connect-server-core

private void impersonateSubject(FilterChain filterChain, HttpServletRequest request, HttpServletResponse response, UserProfile userProfile) throws IOException, ServletException {
  // Products use the username to set the authentication context.
  SimplePrincipal principal = new SimplePrincipal(userProfile.getUsername());
  final Authenticator.Result authenticationResult = new Authenticator.Result.Success(createMessage("Successful three-legged-auth"), principal);
  authenticationListener.authenticationSuccess(authenticationResult, request, response);
  filterChain.doFilter(request, response);
}
origin: com.atlassian.plugins/atlassian-connect-server-core

private void fail(HttpServletRequest request, HttpServletResponse response, String externallyVisibleMessage, int httpResponseCode) {
  sendErrorResponse(response, httpResponseCode, externallyVisibleMessage);
  authenticationListener.authenticationFailure(new Authenticator.Result.Failure(createMessage("")), request, response);
}
origin: com.atlassian.plugins/atlassian-connect-server-core

private boolean authenticationNotAttempted(HttpServletRequest request, HttpServletResponse response) {
  authenticationListener.authenticationNotAttempted(request, response);
  return true;
}
origin: com.atlassian.oauth/atlassian-oauth-service-provider-plugin

private Result handleException(HttpServletResponse response, OAuthMessage message, Exception e) {
  // this isn't likely to happen, it would result from some unknown error with the request that the OAuth.net
  // library couldn't handle appropriately
  LOG.error("Failed to validate OAuth message", e);
  sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
  return new Result.Error(new OAuthProblem.System(e));
}
origin: com.atlassian.fisheye/sal-fisheye-plugin

public void authenticationSuccess(Authenticator.Result result, HttpServletRequest request, HttpServletResponse response) {
  String name = result.getPrincipal().getName();
  loginUserForThisRequest(name, request);
}
origin: com.atlassian.plugins/atlassian-connect-server-core

if (!authenticationController.shouldAttemptAuthentication(request)) {
  return authenticationNotAttempted(request, response);
final Result result = authenticator.authenticate(request, response);
switch (result.getStatus()) {
  case SUCCESS:
    authenticationListener.authenticationSuccess(result, request, response);
    return true;
  case NO_ATTEMPT:
    authenticationListener.authenticationNotAttempted(request, response);
    return true;
  case FAILED:
    authenticationListener.authenticationFailure(result, request, response);
    setFailureResponse(result, response);
    return false;
  case ERROR:
  default:
    authenticationListener.authenticationError(result, request, response);
    setErrorResponse(result, response);
    return false;
origin: com.atlassian.plugins/atlassian-connect-core

private void impersonateSubject(FilterChain filterChain, HttpServletRequest request, HttpServletResponse response, UserProfile userProfile) throws IOException, ServletException {
  // Products use the username to set the authentication context.
  SimplePrincipal principal = new SimplePrincipal(userProfile.getUsername());
  final Authenticator.Result authenticationResult = new Authenticator.Result.Success(createMessage("Successful three-legged-auth"), principal);
  authenticationListener.authenticationSuccess(authenticationResult, request, response);
  filterChain.doFilter(request, response);
}
origin: com.atlassian.plugins/oauth2

private boolean authenticationNotAttempted(HttpServletRequest request, HttpServletResponse response) {
  authenticationListener.authenticationNotAttempted(request, response);
  return true;
}
origin: com.atlassian.plugins/atlassian-connect-core

private void actAsAddonUser(FilterChain filterChain, HttpServletRequest request, HttpServletResponse response, String addonKey) throws IOException, ServletException {
  try {
    final Principal principal = getPrincipal(addonKey);
    final Authenticator.Result authenticationResult = new Authenticator.Result.Success(createMessage("Successful two-legged-auth"), principal);
    authenticationListener.authenticationSuccess(authenticationResult, request, response);
    filterChain.doFilter(request, response);
  } catch (InvalidSubjectException e) {
    createAndSendFailure(e, response, HttpServletResponse.SC_UNAUTHORIZED, i18nResolver.getText(BAD_CREDENTIALS_KEY));
  }
}
com.atlassian.sal.api.auth

Most used classes

  • LoginUriProvider
  • Authenticator$Result
  • AuthenticationController
  • AuthenticationListener
  • Authenticator$Result$Failure
  • Authenticator$Result$Error,
  • Authenticator,
  • Authenticator$Result$NoAttempt,
  • OAuthRequestVerifier,
  • OAuthRequestVerifierFactory
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now