Package org.restlet.security

Examples of org.restlet.security.User


      Representation validationResult = serviceValidate.get();
      ServiceResponse serviceResponse = ServiceResponseParser.parse(validationResult.getStream());

      if (serviceResponse instanceof AuthSuccess) {
        AuthSuccess authSuccess = (AuthSuccess)serviceResponse;
        request.getClientInfo().setUser(new User(authSuccess.getUser()));
        logger.debug("Validated CAS-ticket for user '{}'", authSuccess.getUser());

        if (authSuccess.getProxyGrantingTicket() != null) {
          String pgtId = pgtIouMap.remove(authSuccess.getProxyGrantingTicket());
          if (pgtId != null) {
View Full Code Here


    return new StringRepresentation("no longer logged in");
  }

  private static String getUserID(ClientInfo clientInfo) {
    // TODO: find out whether to use getUser() or getPrincipals()
    User user = clientInfo.getUser();
    if (user != null && user.getIdentifier() != null) {
      return user.getIdentifier();
    }

    for (Principal principal : clientInfo.getPrincipals()) {
      if (principal.getName() != null) {
        return principal.getName();
View Full Code Here

    }

    @Override
    protected boolean authenticate(Request request, Response response) {
        Form f = request.getResourceRef().getQueryAsForm();
        User u = request.getClientInfo().getUser();
        String identifier = request.getCookies()
                .getFirstValue(identifierCookie);
        String origRef;
        if (identifier != null) {
            u = new User(identifier);
            request.getClientInfo().setUser(u);
            return true;
        }
        if (request.getCookies().getFirstValue(origRefCookie) == null) {
            origRef = request.getResourceRef().toString();
View Full Code Here

            } else {
                if (!obj.isNull("id")) {
                    try {
                        Context.getCurrentLogger().info(obj.toString(2));
                        String id = obj.getString("id");
                        User u = new User();
                        u.setIdentifier(id);
                        request.getClientInfo().setUser(u);
                        // set any attributes
                        setAttributes(optionalAttributes, obj, u);
                        setAttributes(requiredAttributes, obj, u);
                        return Verifier.RESULT_VALID;
View Full Code Here

                    }
                }
            }

            if (result == RESULT_VALID) {
                request.getClientInfo().setUser(new User(username));
            }
        }

        return result;
    }
View Full Code Here

        String sigToCompare = AwsUtils.getSignature(request, userSecret);

        if (!compare(signature, sigToCompare.toCharArray()))
            return RESULT_INVALID;

        request.getClientInfo().setUser(new User(userId));

        return RESULT_VALID;
    }
View Full Code Here

        log.info("In Authorize");
        if (myId != null && myId.length() > 0) { // Already know what user
            log.info("User known");
            return true;
        } else {
            User user = request.getClientInfo().getUser();
            getLogger().info("User from ClientInfo = " + user);
            boolean cont;
            if (user == null) {
                cont = super.authorize(request, response);
                if (!cont)
View Full Code Here

                if ((request.getClientInfo().getUser() == null)
                        && (this.userPrincipalClassName != null)
                        && (principal.getClass().getName()
                                .equals(this.userPrincipalClassName))) {
                    request.getClientInfo().setUser(
                            new User(principal.getName()));
                }
            }
        } catch (LoginException le) {
            result = RESULT_INVALID;
        }
View Full Code Here

            throws JSONException {
        String tokenOwner = response.getString("tokenOwner");
        getLogger().info(
                "User " + tokenOwner + " is accessing : "
                        + req.getOriginalRef());
        User user = new User(tokenOwner, accessToken);

        // Set the user so that the Resource knows who is executing
        // Based on the person issuing the token in the first place.
        req.getClientInfo().setUser(user);
        req.getClientInfo().setAuthenticated(true);
View Full Code Here

        MemoryRealm realm = new MemoryRealm();
        context.setDefaultEnroler(realm.getEnroler());
        context.setDefaultVerifier(realm.getVerifier());

        // Add users
        User stiger = new User("stiger", "pwd", "Scott", "Tiger",
                "scott.tiger@foobar.com");
        realm.getUsers().add(stiger);

        User larmstrong = new User("larmstrong", "pwd", "Louis", "Armstrong",
                "la@foobar.com");
        realm.getUsers().add(larmstrong);

        // Add groups
        Group employees = new Group("employees ", "All FooBar employees");
View Full Code Here

TOP

Related Classes of org.restlet.security.User

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.