Package org.nimbustools.querygeneral.security

Examples of org.nimbustools.querygeneral.security.QueryUser


    private String getCallerDn() {
        final SecurityContext context = SecurityContextHolder.getContext();

        final Authentication auth = context.getAuthentication();
        final QueryUser principal = (QueryUser) auth.getPrincipal();

        return principal.getDn();
    }
View Full Code Here


        if (hasTimestamp == hasExpires) {
            throw new QueryException(QueryError.InvalidArgument,
                    "Request must have timestamp or expiration, but not both");
        }

        final QueryUser user;
        try {
        user = userDetailsService.loadUserByUsername(accessId);
        } catch (UsernameNotFoundException e) {
            throw new QueryException(QueryError.InvalidClientTokenId, e);
        } catch (DataAccessException e) {
            throw new QueryException(QueryError.InternalError,
                    "Failed to retrieve user token for provided accessID", e);
        }
        final String secret = user.getSecret();

        final String stringToSign;
        if (SIGNATURE_VERSION_2.equals(signatureVersion)) {
            stringToSign = getStringToSign_v2(request);
        } else {
View Full Code Here

        if (auth == null || !(auth instanceof QueryAuthenticationToken)) {
            throw new RemoteException("Could not obtain a valid authentication token");
        }

        final QueryAuthenticationToken token = (QueryAuthenticationToken) auth;
        final QueryUser principal = token.getPrincipal();

        if (principal == null) {
            throw new RemoteException("Could not obtain Principal from authentication token");
        }

        final String dn = principal.getDn();
        if (dn == null || dn.length() == 0) {
            throw new RemoteException("Could not obtain a valid DN");
        }

        final _Caller caller = this.repr._newCaller();
View Full Code Here

                    "caller must be non-null and have a valid identity");
        }
        final String dn = caller.getIdentity();

        try {
            final QueryUser user =
                    userDetailsService.loadUserByDn(dn);

            return user.getAccessID();

        } catch (DataAccessException e) {
            throw new CannotTranslateException(
                    "Unable to resolve DN to an accessID",e);
        } catch (UsernameNotFoundException e) {
View Full Code Here

            if (secret == null || dn == null) {
                throw new UsernameNotFoundException("User record is missing or incomplete");
            }

            return new QueryUser(username,secret, dn);


        } catch (AuthzDBException e) {
            throw new UsernameNotFoundException("Failed to retrieve credentials for access ID " + username, e);
        }
View Full Code Here

            if (secret == null || accessId == null) {
                throw new UsernameNotFoundException("User DN '" + dn + "' does not map to query credentials");
            }

            return new QueryUser(accessId, secret, dn);


        } catch (AuthzDBException e) {
            throw new UsernameNotFoundException("Failed to retrieve query credentials for DN '" + dn + "'", e);
        }
View Full Code Here

TOP

Related Classes of org.nimbustools.querygeneral.security.QueryUser

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.