Package io.fathom.cloud.protobuf.CloudCommons

Examples of io.fathom.cloud.protobuf.CloudCommons.TokenInfo


        if (tokenId == null) {
            // Allow an anonymous connection through
            return true;
        }

        TokenInfo tokenInfo = null;
        try {
            tokenInfo = tokenService.findValidToken(tokenId);
        } catch (Exception e) {
            log.warn("Unexpected error while reading token", e);
        }
View Full Code Here


        try {
            byte[] tokenBytes = Base64Coder.decodeWebSafe(tokenString);

            Token token = Token.parseFrom(tokenBytes);

            TokenInfo tokenInfo = token.getTokenInfo();
            byte[] plaintext = tokenInfo.toByteArray();
            if (!getSigner().verify(plaintext, token.getSignature().toByteArray())) {
                log.debug("Token signature verification failed");
                return null;
            }
View Full Code Here

        if (authentication == null) {
            return null;
        }

        TokenInfo tokenInfo = loginService.buildTokenInfo(authentication);
        return new TokenAuth(tokenInfo);
    }
View Full Code Here

        return created.getId();
    }

    public AuthenticatedUser toAuthenticatedUser(Auth auth) throws CloudException {
        TokenAuth tokenAuth = (TokenAuth) auth;
        TokenInfo tokenInfo = tokenAuth.getTokenInfo();
        AuthenticatedUser authenticatedUser = loginService.authenticate(tokenInfo);
        return authenticatedUser;
    }
View Full Code Here

        AuthenticatedUser auth = loginService.authenticate(authToken);
        if (auth == null) {
            throw new WebApplicationException(Status.UNAUTHORIZED);
        }

        TokenInfo subject = tokenService.findValidToken(subjectToken);
        if (subject == null) {
            throw new WebApplicationException(Status.NOT_FOUND);
        }

        ResponseBuilder response = Response.ok();
View Full Code Here

    public WrappedCredential createEc2Credential() throws CloudException, DuplicateValueException {
        UserData forUser = getUser(Long.valueOf(userId));

        WrappedCredential response = new WrappedCredential();

        TokenInfo tokenInfo = findTokenInfo();
        if (tokenInfo == null) {
            throw new WebApplicationException(Status.UNAUTHORIZED);
        }
        long projectId = tokenInfo.getProjectId();
        if (projectId == 0) {
            throw new WebApplicationException(Status.UNAUTHORIZED);
        }

        String accessId;
View Full Code Here

        V2Token token = access.token = new V2Token();

        ProjectData project = authentication.getProject();

        // We never pass domain; we can't build a domain token with V2
        TokenInfo tokenInfo = loginService.buildTokenInfo(authentication);

        token.expires = TokenAuth.getExpiration(tokenInfo);
        token.id = tokenService.encodeToken(tokenInfo);
        if (project != null) {
            Tenant tenant = new Tenant();
View Full Code Here

        }

        if (auth instanceof TokenAuth) {
            TokenAuth tokenAuth = (TokenAuth) auth;

            TokenInfo tokenInfo = tokenAuth.getTokenInfo();
            return tokenInfo;
        } else {
            throw new IllegalArgumentException();
        }
    }
View Full Code Here

    private AuthenticatedUser authenticatedUser = null;

    protected AuthenticatedUser findAuthenticatedUser() throws CloudException {
        if (this.authenticatedUser == null) {
            TokenAuth auth = (TokenAuth) getAuth();
            TokenInfo tokenInfo = auth.getTokenInfo();
            this.authenticatedUser = loginService.authenticate(tokenInfo);
        }
        return this.authenticatedUser;
    }
View Full Code Here

            userWithSecret = authenticate(domain, authRequest.passwordCredentials.username,
                    authRequest.passwordCredentials.password);
        } else if (authRequest.tokenCredentials != null) {
            String tokenId = authRequest.tokenCredentials.id;

            TokenInfo tokenInfo = findTokenInfo(tokenId);
            if (tokenInfo == null) {
                return null;
            }

            userWithSecret = checkSecret(tokenInfo);

            domain = authRepository.getDomains().find(tokenInfo.getDomainId());
            if (domain == null) {
                throw new IllegalStateException();
            }

            if (projectSpec.projectId == 0 && projectSpec.projectName == null) {
                log.info("Token login with scope: {}", tokenInfo.getTokenScope());

                if (tokenInfo.getTokenScope() == TokenScope.Project) {
                    projectSpec.projectId = tokenInfo.getProjectId();
                    log.info("Set projectId to: {}", projectSpec.projectId);
                }
            }
            // This is weird, but valid with V3's deprecation of unscoped
            // tokens...
View Full Code Here

TOP

Related Classes of io.fathom.cloud.protobuf.CloudCommons.TokenInfo

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.