Package io.fathom.cloud.identity.model

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


        Auth auth = getAuth();

        Project project = auth.getProject();

        AuthenticatedUser authenticatedUser = ((AuthServiceImpl) authService).toAuthenticatedUser(auth);
        AuthenticatedProject authenticatedProject = identityService.authenticateToProject(authenticatedUser,
                project.getId());

        RoleData role = getRole();

        DomainData domain = identityService.getDefaultDomain();
View Full Code Here


    public Response grantRoleToUserOnProject(@PathParam("project_id") long projectId,
            @PathParam("user_id") long userId, @PathParam("role_id") long roleId) throws CloudException {
        AuthenticatedUser currentUser = getAuthenticatedUser();
        UserData grantee = getUser(userId);

        AuthenticatedProject authenticatedProject = identityService.authenticateToProject(currentUser, projectId);
        if (authenticatedProject == null) {
            // Forbidden?
            log.info("Cannot authenticate to project: {} as user: {}", projectId, currentUser);
            throw new WebApplicationException(Status.NOT_FOUND);
        }
View Full Code Here

                projectKey = KeyczarUtils.unpack(projectKeyBytes.toByteArray());
            } catch (KeyczarException e) {
                throw new IllegalStateException("Error reading project key", e);
            }
            SecretToken token = new SecretToken(SecretTokenType.PROJECT_SECRET, projectKey, null);
            return new AuthenticatedProject(project, token);
        } else if (version == 0) {
            // We had a project key in version 0, but we didn't use it!
            return new AuthenticatedProject(project, null);
        } else {
            throw new IllegalStateException();
        }
    }
View Full Code Here

        ProjectData created = authRepository.getProjects().create(b);

        SecretToken secretToken = SecretToken.create(SecretTokenType.PROJECT_SECRET);

        AuthenticatedProject authenticatedProject = new AuthenticatedProject(created, secretToken);

        grantRoleToUserOnProject(authenticatedProject, owner.getUserId(), ownerRoleId);

        return created;
    }
View Full Code Here

                AesKey cryptoKey = KeyczarUtils.generateSymmetricKey();

                long userId = user.getUserId();

                SecretToken secretToken = new SecretToken(SecretTokenType.PROJECT_SECRET, cryptoKey, null);
                AuthenticatedProject authenticatedProject = new AuthenticatedProject(project, secretToken);

                grantRoleToUserOnProject(authenticatedProject, userId, WellKnownRoles.ROLE_ID_ADMIN);
            } else {
                log.warn("User is not admin, cannot create secret");
            }
View Full Code Here

        ProjectData project = findProject(user, projectId);
        if (project == null) {
            return null;
        }

        AuthenticatedProject authenticatedProject = secretService.authenticate(project, user);
        if (authenticatedProject == null) {
            return null;
        }

        return authenticatedProject;
View Full Code Here

            throw new IllegalArgumentException();
        }

        long projectId = project.getId();

        AuthenticatedProject authenticatedProject = identityService.authenticateToProject(user, projectId);
        if (authenticatedProject == null) {
            throw new IllegalStateException();
        }

        NamedItemCollection<AttachmentData> store = authRepository.getProjectAttachments(projectId);
View Full Code Here

            throw new IllegalArgumentException();
        }

        long projectId = project.getId();

        AuthenticatedProject authenticatedProject = identityService.authenticateToProject(user, projectId);
        if (authenticatedProject == null) {
            throw new IllegalStateException();
        }

        NamedItemCollection<AttachmentData> store = authRepository.getProjectAttachments(projectId);
View Full Code Here

    @Override
    public ClientApp createClientApp(Auth auth, Project project, String appName, String appPassword)
            throws CloudException {
        AuthenticatedUser authenticatedUser = authService.toAuthenticatedUser(auth);

        AuthenticatedProject authenticatedProject = identityService.authenticateToProject(authenticatedUser,
                project.getId());
        if (authenticatedProject == null) {
            throw new IllegalStateException();
        }
View Full Code Here

TOP

Related Classes of io.fathom.cloud.identity.model.AuthenticatedProject

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.