Package io.fathom.cloud.protobuf.IdentityModel

Examples of io.fathom.cloud.protobuf.IdentityModel.DomainData


        AuthenticatedProject authenticatedProject = identityService.authenticateToProject(authenticatedUser,
                project.getId());

        RoleData role = getRole();

        DomainData domain = identityService.getDefaultDomain();

        UserData grantee = getGrantee(domain);

        log.info("Doing project grant: {} {}", grantee.getName(), role.getName());
        identityService.grantRoleToUserOnProject(authenticatedProject, grantee.getId(), role.getId());
View Full Code Here


    @Override
    protected UserData run0() throws CloudException {
        log.info("Creating user: {}", username);

        DomainData domain = identityService.getDefaultDomain();
        if (domain == null) {
            throw new UnsupportedOperationException();
        }

        UserData.Builder userBuilder = UserData.newBuilder();
        userBuilder.setName(username);
        // userBuilder.setEmail(username);
        userBuilder.setEnabled(true);

        UserData user = identityService.createUser(new UserCreationData(domain, userBuilder, password));

        Long projectId = null;

        AuthenticatedUser authenticatedUser = loginService.authenticate(projectId, username, password);
        if (authenticatedUser == null) {
            throw new IllegalStateException();
        }

        boolean CREATE_PROJECT = false;
        if (CREATE_PROJECT) {
            ProjectData.Builder projectBuilder = ProjectData.newBuilder();
            projectBuilder.setName("default");
            projectBuilder.setDomainId(domain.getId());

            ProjectData project = identityService.createProject(projectBuilder, authenticatedUser,
                    WellKnownRoles.ROLE_ID_ADMIN);
            if (project == null) {
                throw new IllegalStateException();
View Full Code Here

        return role;
    }

    private void doDomainGrant() throws CloudException {
        // Domain grant
        DomainData domain = identityService.getDefaultDomain();

        RoleData role = getRole();

        UserData user = getGrantee(domain);

        log.info("Doing domain grant: {} {}", user.getName(), role.getName());
        identityService.grantDomainRoleToUser(domain.getId(), user.getId(), role.getId());
    }
View Full Code Here

        log.info("Loading password-recovery key from {}", path);

        KeyczarFileReader store = new KeyczarFileReader(path.getAbsolutePath());

        DomainData domain = identityService.getDefaultDomain();
        loginService.changePassword(domain, username, password, store);
    }
View Full Code Here

    @GET
    @Path("{id}")
    public DomainWrapper getDomain(@PathParam("id") String id) throws CloudException {
        UserData user = getUser();

        DomainData data = identityService.findDomain(user, id);
        notFoundIfNull(data);

        DomainWrapper response = new DomainWrapper();
        response.domain = toModel(data);
        return response;
View Full Code Here

        UserData user = authRepository.getUsers().find(token.getUserId());
        if (user == null) {
            throw new IllegalStateException();
        }

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

        response.user = toModel(domain, user);

        List<RoleData> roles = null;

        switch (token.getTokenScope()) {
        case Domain: {
            // Domain scoped
            DomainData scope = authRepository.getDomains().find(token.getDomainId());
            if (scope == null) {
                throw new IllegalStateException();
            }

            response.domainScope = toModel(domain);

            response.serviceCatalog = loginService.buildServiceMap(getBaseUrl(), null);
            break;
        }

        case Project: {
            // Project scoped
            ProjectData scope = authRepository.getProjects().find(token.getProjectId());
            if (scope == null) {
                throw new IllegalStateException();
            }

            DomainData projectDomain = authRepository.getDomains().find(scope.getDomainId());
            if (projectDomain == null) {
                throw new IllegalStateException();
            }

            response.projectScope = toModel(projectDomain, scope);
View Full Code Here

            throw new WebApplicationException(Status.FORBIDDEN);
        }

        User req = wrappedUser.user;

        DomainData domainData = authRepository.getDomains().find(domain.getId());
        if (domainData == null) {
            throw new IllegalStateException();
        }

        if (Strings.isNullOrEmpty(req.domainId)) {
            // domain = getDomainFromToken();
        } else {
            if (Long.valueOf(req.domainId) != domainData.getId()) {
                // TODO: Allow this?
                throw new UnsupportedOperationException();
            }
            // domain = getDomain(Long.valueOf(req.domainId));
        }
View Full Code Here

    @Override
    @Transactional
    public AuthenticatedUser authenticate(V2AuthCredentials authRequest, ClientCertificate clientCertificate)
            throws CloudException {
        DomainData domain = null;
        UserWithSecret userWithSecret = null;

        log.info("V2 Auth request: " + authRequest);

        ProjectSpec projectSpec = new ProjectSpec();
View Full Code Here

    }

    @Override
    @Transactional
    public AuthenticatedUser authenticate(TokenInfo tokenInfo) throws CloudException {
        DomainData domain = findDomainFromToken(tokenInfo);

        UserWithSecret userWithSecret = checkSecret(tokenInfo);
        if (userWithSecret == null) {
            return null;
        }
View Full Code Here

    }

    @Override
    @Transactional
    public AuthenticatedUser authenticate(Long projectId, String username, String password) throws CloudException {
        DomainData domain = identityService.getDefaultDomain();
        UserWithSecret userWithSecret = authenticate(domain, username, password);
        if (userWithSecret == null) {
            return null;
        }
View Full Code Here

TOP

Related Classes of io.fathom.cloud.protobuf.IdentityModel.DomainData

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.