Examples of AuthResult


Examples of com.adobe.idp.um.api.infomodel.AuthResult


    public static void impersonateUserAndSetClientFactory(String canonicalName, String domainName, ServiceClientFactory serviceClientFactory,ResourceManager resourceManager)
            throws UMException {
        AuthenticationManagerServiceClient authClient = new AuthenticationManagerServiceClient(serviceClientFactory);
        AuthResult authResultAdmin = authClient
                .authenticate(resourceManager.getPropValue(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME), resourceManager.getPropValue(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD).getBytes());
        Context context = new Context();
        context.initPrincipal(authResultAdmin);
        AuthResult authResult = authClient.getAuthResultOnBehalfOfUser(
                canonicalName, domainName, context);

        Context impersonateContext = new Context();
        impersonateContext.initPrincipal(authResult);
        serviceClientFactory.setContext(impersonateContext);
View Full Code Here

Examples of com.caucho.hmtp.AuthResult

    _clientManager.login(uid, query.getResource());
   
    notifyValidLogin(from);
   
    AuthResult result = new AuthResult(_clientManager.getAddress());
    getBroker().queryResult(id, from, to, result);
  }
View Full Code Here

Examples of com.google.gerrit.server.account.AuthResult

    username = username.trim();

    final AuthRequest req = AuthRequest.forUser(username);
    req.setPassword(password);

    final AuthResult res;
    try {
      res = accountManager.authenticate(req);
    } catch (AccountUserNameException e) {
      // entered user name and password were correct, but user name could not be
      // set for the newly created account and this is why the login fails,
      // error screen with error message should be shown to the user
      callback.onFailure(e);
      return;
    } catch (AuthenticationUnavailableException e) {
      result.setError(LoginResult.Error.AUTHENTICATION_UNAVAILABLE);
      callback.onSuccess(result);
      return;
    } catch (AccountException e) {
      log.info(String.format("'%s' failed to sign in: %s", username, e.getMessage()));
      result.setError(LoginResult.Error.INVALID_LOGIN);
      callback.onSuccess(result);
      return;
    }

    result.success = true;
    result.isNew = res.isNew();
    webSession.get().login(res, AuthMethod.PASSWORD,
                           true /* persistent cookie */);
    callback.onSuccess(result);
  }
View Full Code Here

Examples of com.google.gerrit.server.account.AuthResult

      }
      return;
    }

    final AuthRequest areq = AuthRequest.forUser(user);
    final AuthResult arsp;
    try {
      arsp = accountManager.authenticate(areq);
    } catch (AccountException e) {
      log.error("Unable to authenticate user \"" + user + "\"", e);
      rsp.sendError(HttpServletResponse.SC_FORBIDDEN);
      return;
    }

    final StringBuilder rdr = new StringBuilder();
    rdr.append(urlProvider.get());
    rdr.append('#');
    if (arsp.isNew() && !token.startsWith(PageLinks.REGISTER + "/")) {
      rdr.append(PageLinks.REGISTER);
    }
    rdr.append(token);

    webSession.get().login(arsp, AuthMethod.COOKIE,
View Full Code Here

Examples of com.google.gerrit.server.account.AuthResult

      final HttpServletResponse rsp) throws IOException, ServletException {
    rsp.setHeader("Expires", "Fri, 01 Jan 1980 00:00:00 GMT");
    rsp.setHeader("Pragma", "no-cache");
    rsp.setHeader("Cache-Control", "no-cache, must-revalidate");

    final AuthResult res;
    if ("create_account".equals(req.getParameter("action"))) {
      res = create();

    } else if (req.getParameter("user_name") != null) {
      res = byUserName(rsp, req.getParameter("user_name"));

    } else if (req.getParameter("preferred_email") != null) {
      res = byPreferredEmail(rsp, req.getParameter("preferred_email"));

    } else if (req.getParameter("account_id") != null) {
      res = byAccountId(rsp, req.getParameter("account_id"));

    } else {
      byte[] raw;
      try {
        raw = prepareHtmlOutput();
      } catch (OrmException e) {
        throw new ServletException(e);
      }
      rsp.setContentType("text/html");
      rsp.setCharacterEncoding(HtmlDomUtil.ENC);
      rsp.setContentLength(raw.length);
      final OutputStream out = rsp.getOutputStream();
      try {
        out.write(raw);
      } finally {
        out.close();
      }
      return;
    }

    if (res != null) {
      webSession.get().login(res, AuthMethod.BACKDOOR, false);
      final StringBuilder rdr = new StringBuilder();
      rdr.append(req.getContextPath());
      if (IS_DEV && req.getParameter("gwt.codesvr") != null) {
        if (rdr.indexOf("?") < 0) {
          rdr.append("?");
        } else {
          rdr.append("&");
        }
        rdr.append("gwt.codesvr=").append(req.getParameter("gwt.codesvr"));
      }
      rdr.append('#');
      if (res.isNew()) {
        rdr.append(PageLinks.REGISTER);
      }
      rdr.append(PageLinks.MINE);
      rsp.sendRedirect(rdr.toString());
View Full Code Here

Examples of com.google.gerrit.server.account.AuthResult

    return HtmlDomUtil.toUTF8(doc);
  }

  private AuthResult auth(final Account account) {
    if (account != null) {
      return new AuthResult(account.getId(), null, false);
    }
    return null;
  }
View Full Code Here

Examples of com.google.gerrit.server.account.AuthResult

    return null;
  }

  private AuthResult auth(final AccountExternalId account) {
    if (account != null) {
      return new AuthResult(account.getAccountId(), null, false);
    }
    return null;
  }
View Full Code Here

Examples of com.google.gerrit.server.account.AuthResult

      userName = m.group(1);
    } else {
      throw new ServletException("Couldn't extract username from your certificate");
    }
    final AuthRequest areq = AuthRequest.forUser(userName);
    final AuthResult arsp;
    try {
      arsp = accountManager.authenticate(areq);
    } catch (AccountException e) {
      String err = "Unable to authenticate user \"" + userName + "\"";
      log.error(err, e);
View Full Code Here

Examples of com.google.gerrit.server.account.AuthResult

    AuthRequest whoAuth = AuthRequest.forUser(username);
    whoAuth.setPassword(password);

    try {
      AuthResult whoAuthResult = accountManager.authenticate(whoAuth);
      session.get().setUserAccountId(whoAuthResult.getAccountId(),
          AuthMethod.PASSWORD);
      return true;
    } catch (AccountException e) {
      log.warn("Authentication failed for " + username, e);
      rsp.sendError(SC_UNAUTHORIZED);
View Full Code Here

Examples of org.apache.geronimo.tomcat.security.AuthResult

            ServerAuthContext authContext = serverAuthConfig.getAuthContext(authContextId, serviceSubject, authProperties);
            Subject clientSubject = new Subject();

            AuthStatus authStatus = authContext.validateRequest(messageInfo, clientSubject, serviceSubject);
            if (authStatus == AuthStatus.SEND_CONTINUE)
                return new AuthResult(TomcatAuthStatus.SEND_CONTINUE, null);
            if (authStatus == AuthStatus.SEND_FAILURE)
                return new AuthResult(TomcatAuthStatus.SEND_FAILURE, null);

            if (authStatus == AuthStatus.SUCCESS) {
                Set<UserIdentity> ids = clientSubject.getPrivateCredentials(UserIdentity.class);
                UserIdentity userIdentity;
                if (ids.size() > 0) {
                    userIdentity = ids.iterator().next();
                } else {
                    CallerPrincipalCallback principalCallback = callbackHandler.getThreadCallerPrincipalCallback();
                    if (principalCallback == null) throw new NullPointerException("No CallerPrincipalCallback");
                    Principal principal = principalCallback.getPrincipal();
                    if (principal == null) {
                        String principalName = principalCallback.getName();
                        Set<Principal> principals = principalCallback.getSubject().getPrincipals();
                        for (Principal p : principals) {
                            if (p.getName().equals(principalName)) {
                                principal = p;
                                break;
                            }
                        }
                        if (principal == null) {
                            //TODO not clear what to do here.
                            return new AuthResult(TomcatAuthStatus.SUCCESS, null);
                        }
                    }
                    GroupPrincipalCallback groupPrincipalCallback = callbackHandler.getThreadGroupPrincipalCallback();
                    String[] groups = groupPrincipalCallback == null ? null : groupPrincipalCallback.getGroups();
                    userIdentity = identityService.newUserIdentity(clientSubject, principal, Arrays.asList(groups));
                }
                return new AuthResult(TomcatAuthStatus.SUCCESS, userIdentity);
            }
            if (authStatus == AuthStatus.SEND_SUCCESS) {
                //we are processing a message in a secureResponse dialog.
                return new AuthResult(TomcatAuthStatus.SEND_SUCCESS, null);
            }
            //should not happen
            throw new NullPointerException("No AuthStatus returned");
        } catch (AuthException e) {
            throw new ServerAuthException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.