Examples of UnauthorizedException


Examples of org.tamacat.httpd.exception.UnauthorizedException

      Digest digest = new Digest(line);

      if (authComponent != null) {
        AuthUser user = authComponent.getAuthUser(digest.getUsername(),  context);
        String hashedPassword = null;
        if (user == null) throw new UnauthorizedException();
        if (user.isEncrypted() == false) {
          //A1 = username:realm:password
          String a1 = user.getAuthUsername() + ":"
            + realm + ":" + user.getAuthPassword();
          String hash1 = encode(getMD5(a1));
         
          //A2 = Method:URI
          String a2 = request.getRequestLine().getMethod()
            + ":" + request.getRequestLine().getUri();
          String hash2 = encode(getMD5(a2));

          //Digest = A1:nonce:nonce-count:cnonce:qop:A2
          String digestPassword = hash1 + ":" + digest.getNonce()
            + ":" + digest.getNc() + ":" + digest.getCnonce()
            + ":" + digest.getQop() + ":" + hash2;
          hashedPassword = encode(getMD5(digestPassword));
        }
        String username = digest.getUsername();
        String password = digest.getResponse();
        if (username != null && password != null
            && username.equals(user.getAuthUsername())
            && password.equals(hashedPassword)) {
          return user.getAuthUsername();
        }
      }
    }
    throw new UnauthorizedException();
  }
View Full Code Here

Examples of slash.navigation.rest.exception.UnAuthorizedException

        Post request = new Post(getUsersUrl(), credentials);
        request.addFile("file", xml.getBytes());

        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot add user " + userName, getUsersUrl());
        if (request.isForbidden())
            throw new DuplicateNameException("Cannot add user " + userName, getUsersUrl());
        if (!request.isSuccessful())
            throw new IOException("POST on " + getUsersUrl() + " with payload " + userName + "," + firstName + "," + lastName + "," + email + " not successful: " + result);
        return request.getLocation();
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.