Package org.ugate.service.entity.jpa

Examples of org.ugate.service.entity.jpa.Actor


  public Actor authenticate(final String username, final String password) {
    try {
      if (password == null || password.isEmpty()) {
        return null;
      }
      final Actor actor = credentialDao.getActor(username);
      if (actor != null) {
        if (actor.getPassword().equals(password)
            || hasDigestMatch(username, actor.getPassword(),
                password, actor.getPassPhrase())) {
          return actor;
        }
      } else if (log.isDebugEnabled()) {
        log.debug(String
            .format("No %1$s exists with a login of %2$s and the supplied password",
View Full Code Here


          || credentials.toString().isEmpty()) {
        throw new IllegalArgumentException(String.format(
            "Invalid username/password combination for %1$s",
            username));
      }
      final Actor actor = ServiceProvider.IMPL.getCredentialService().authenticate(username,
            credentials.toString());
      if (actor == null) {
        throw new AuthenticationException(Actor.class.getName() + ':' + username);
      }
      final String[] roles = new String[actor.getRoles().size()];
      int i = -1;
      for (final Role role : actor.getRoles()) {
        roles[++i] = role.getRole();
      }
      // The password should already be an MD5 hash using the same salt pattern as the
      // JPA provider
      final Credential cred = Credential.getCredential(MD5.__TYPE + actor.getPassword());
      return putUser(username, cred, roles);
    } catch (final Throwable t) {
      final String msg = String.format("Unable to authenticate %1$s",
          username);
      if (log.isDebugEnabled()) {
View Full Code Here

        ni = e.nextElement();
        e2 = ni.getInetAddresses();
        while (e2.hasMoreElements()) {
          ip = e2.nextElement();
          if (req.getRemoteAddr().equals(ip.getHostAddress())) {
            final Actor actor = ServiceProvider.IMPL
                .getCredentialService().getActorById(
                    Integer.valueOf(actorId));
            if (actor != null) {
              req.login(actor.getUsername(), actor.getPassword());
              return true;
            }
            return false;
          }
        }
View Full Code Here

   */
  @Override
  protected RequiredValues processContext(final HttpServletRequest req,
      final HttpServletResponse res, final ServletContext servletContext,
      final WebContext ctx) throws Throwable {
    final Actor actor = findActor(req);
    if (actor == null) {
      req.authenticate(res);
    }
    final Integer rnId = getParameter(req, RemoteNodeType.ID.getKey(), Integer.class);
    RemoteNode rn = null;
    if (rnId != null) {
      rn = getRemoteNode(actor, rnId);
      if (rn != null) {
        ctx.setVariable(VAR_REMOTE_NODE_NAME, rn);
        addRemoteNodeReadingVars(rn, ctx);
        addRemoteNodeVars(rn, ctx);
      }
    }
    if (rn == null) {
      rn = new RemoteNode();
      rn.setAddress("");
      ctx.setVariable(VAR_REMOTE_NODE_NAME, rn);
    }
    ctx.setVariable(VAR_REMOTE_NODES_NAME, actor.getHost().getRemoteNodes());
    return null;
  }
View Full Code Here

TOP

Related Classes of org.ugate.service.entity.jpa.Actor

Copyright © 2018 www.massapicom. 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.