Examples of AuthenticatedUser


Examples of io.fathom.cloud.identity.model.AuthenticatedUser

        if (!authToken.equals(subjectToken)) {
            // For now, we only allow same-token auth
            throw new UnsupportedOperationException();
        }

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

        TokenInfo subject = tokenService.findValidToken(subjectToken);
View Full Code Here

Examples of io.fathom.cloud.identity.model.AuthenticatedUser

    IdentityService identityService;

    @GET
    @Produces({ JSON })
    public GroupList listGroup() throws CloudException {
        AuthenticatedUser user = getAuthenticatedUser();

        GroupList response = new GroupList();
        response.groups = Lists.newArrayList();

        for (GroupData data : identityService.listGroups(user)) {
View Full Code Here

Examples of io.fathom.cloud.identity.model.AuthenticatedUser

                }
            }
        }

        AuthenticatedUser authentication = null;

        if (authRequest != null) {
            authentication = loginService.authenticate(authRequest, clientCertificate);
        }

        if (authentication == null) {
            throw new WebApplicationException(Status.UNAUTHORIZED);
        }

        V2AuthResponse response = new V2AuthResponse();

        Access access = response.access = new Access();
        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();
            tenant.id = "" + project.getId();
            tenant.name = project.getName();
            token.tenant = tenant;
        }

        if (project != null) {
            List<Service> v3Services = loginService.buildServiceMap(getBaseUrl(), project);

            access.services = toV2Services(project, v3Services);
        }

        User user = access.user = new User();
        user.id = "" + authentication.getUserData().getId();
        user.name = authentication.getUserData().getName();

        if (authentication.getProjectRoleIds() != null) {
            user.roles = Lists.newArrayList();

            for (long roleId : authentication.getProjectRoleIds()) {
                RoleData role = identityService.findRole(roleId);
                if (role == null) {
                    throw new IllegalStateException();
                }
View Full Code Here

Examples of io.fathom.cloud.identity.model.AuthenticatedUser

    @PATCH
    @Path("{id}")
    @Produces({ JSON })
    public WrappedUser patchUser(@PathParam("id") long id, WrappedUser wrapped) throws CloudException {
        AuthenticatedUser user = getAuthenticatedUser();

        NumberedItemCollection<UserData> users = authRepository.getUsers();

        // UserData user = users.find(id);
        // if (user == null) {
        // throw new WebApplicationException(Status.NOT_FOUND);
        // }

        if (id != user.getUserId()) {
            // requireAdmin();
            // Tricky to change password
            // TODO: Support changing non-encrypted fields?
            throw new UnsupportedOperationException();
        }

        User req = wrapped.user;

        UserData updated;

        {
            UserData.Builder b = UserData.newBuilder(user.getUserData());

            if (!Strings.isNullOrEmpty(req.description)) {
                b.setDescription(req.description);
            }

            if (req.enabled != null) {
                b.setEnabled(req.enabled);
            }

            if (req.defaultProjectId != null) {
                b.setDefaultProjectId(Long.valueOf(req.defaultProjectId));
            }

            if (!Strings.isNullOrEmpty(req.password)) {
                Secrets.setPassword(b.getSecretStoreBuilder(), req.password, user.getKeys());
                // DomainData domain =
                // authRepository.getDomains().find(user.getDomainId());
                // NamedItemCollection<CredentialData> usernames =
                // authRepository.getUsernames(domain);
                //
View Full Code Here

Examples of io.fathom.cloud.identity.model.AuthenticatedUser

        }
        return this.authenticatedUser;
    }

    protected AuthenticatedUser getAuthenticatedUser() throws CloudException {
        AuthenticatedUser user = findAuthenticatedUser();
        if (user == null) {
            throw new WebApplicationException(Status.UNAUTHORIZED);
        }
        return user;
    }
View Full Code Here

Examples of io.fathom.cloud.identity.model.AuthenticatedUser

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

        AuthenticatedUser user = toAuthenticationV2(domain, projectSpec, userWithSecret);
        return user;
    }
View Full Code Here

Examples of io.fathom.cloud.identity.model.AuthenticatedUser

        ProjectData project = null;
        ProjectRoles projectRoles = null;

        scope = TokenScope.Domain;

        return new AuthenticatedUser(scope, userWithSecret, project, projectRoles, domain);
    }
View Full Code Here

Examples of io.fathom.cloud.identity.model.AuthenticatedUser

        projectRoles = Users.findProjectRoles(user, project.getId());
        if (projectRoles == null) {
            return null;
        }

        return new AuthenticatedUser(scope, userWithSecret, project, projectRoles, domain);
    }
View Full Code Here

Examples of io.fathom.cloud.identity.model.AuthenticatedUser

            log.warn("Cannot find project {}", projectRoles.getProject());
            return null;
        }

        TokenScope scope = TokenScope.Project;
        return new AuthenticatedUser(scope, userWithSecret, project, projectRoles, domain);
    }
View Full Code Here

Examples of io.fathom.cloud.identity.model.AuthenticatedUser

        return new ClientAppImpl(clientApp, secret);
    }

    @Override
    public void setUserSecret(ClientApp app, Auth auth, byte[] payload) throws CloudException {
        AuthenticatedUser user = authService.toAuthenticatedUser(auth);

        long userId = user.getUserId();
        NamedItemCollection<AttachmentData> store = authRepository.getUserAttachments(userId);

        SecretData.Builder s = SecretData.newBuilder();
        try {
            appSecrets.setUserSecret(user, s, payload);
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.