Package io.fathom.cloud.protobuf.IdentityModel

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


        return new AuthenticatedUser(scope, userWithSecret, project, projectRoles, domain);
    }

    private AuthenticatedUser buildProjectToken(DomainData domain, long projectId, UserWithSecret userWithSecret)
            throws CloudException {
        UserData user = userWithSecret.getUserData();

        ProjectRoles projectRoles = Users.findProjectRoles(user, projectId);
        if (projectRoles == null) {
            return null;
        }
View Full Code Here


    Secrets secretService;

    public UserWithSecret migrateUserAddPasswordRecovery(UserWithSecret user, SecretToken secretToken)
            throws CloudException {
        UserSecretData userSecretData = user.userSecretData;
        UserData userData = user.getUserData();

        for (SecretKeyData entry : userData.getSecretStore().getSecretKeyList()) {
            if (entry.getType() == SecretKeyType.ENCRYPTED_WITH_FORGOTPASSWORD_PUBKEY) {
                return user;
            }
        }
View Full Code Here

    }

    public UserWithSecret migrateUser(UserWithSecret user, String password, SecretToken secretToken)
            throws CloudException {
        UserSecretData userSecretData = user.userSecretData;
        UserData userData = user.getUserData();

        if (!userData.getPublicKey().hasKeyczar()) {
            log.info("Migrating user to keyczar: {}", user.getUserData());
            Migrations.report(userData);

            UserData.Builder userDataBuilder = UserData.newBuilder(userData);
            UserSecretData.Builder userSecretDataBuilder = UserSecretData.newBuilder(userSecretData);
View Full Code Here

            s.getPrivateKeyBuilder().setKeyczar(keypair.toString());

            user.setSecretData(Secrets.buildUserSecret(userSecret, s.build()));
        }

        UserData created = authRepository.getUsers().create(user);

        {
            CredentialData.Builder credentialBuilder = CredentialData.newBuilder();

            credentialBuilder.setUserId(created.getId());
            credentialBuilder.setKey(username);

            // if (!Strings.isNullOrEmpty(password)) {
            // PasswordHashData passwordHash = hasher.hash(password);
            // credentialBuilder.setPasswordHash(passwordHash);
            // }

            try {
                usernameStore.create(credentialBuilder);
            } catch (DuplicateValueException e) {
                // TODO: We need to be atomic! ZK supports multi, but it looks
                // complicated
                throw new WebApplicationException(Status.CONFLICT);
            }
        }

        if (challengeKey != null) {
            CredentialData.Builder b = CredentialData.newBuilder();

            b.setUserId(created.getId());
            b.setKey(challengeKey);

            try {
                authRepository.getPublicKeyCredentials(request.domain.getId()).create(b);
            } catch (DuplicateValueException e) {
View Full Code Here

            throw new IllegalArgumentException("Cannot find role");
        }

        long projectId = authenticatedProject.getProjectId();

        UserData granteeData = authRepository.getUsers().find(granteeUserId);
        if (granteeData == null) {
            throw new IllegalArgumentException();
        }

        UserData.Builder b = UserData.newBuilder(granteeData);
View Full Code Here

        RoleData role = authRepository.getRoles().find(roleId);
        if (role == null) {
            throw new IllegalArgumentException("Cannot find role");
        }

        UserData granteeData = authRepository.getUsers().find(granteeUserId);
        if (granteeData == null) {
            throw new IllegalArgumentException();
        }

        DomainData domain = authRepository.getDomains().find(domainId);
View Full Code Here

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

        long userId = credentialData.getUserId();
        UserData user = authRepository.getUsers().find(userId);

        if (user == null) {
            // Unexpected!
            log.warn("Unable to find user for credential: {}", userName);
        }
View Full Code Here

        UserCreationData userCreationData = new UserCreationData(domain, b, password);
        userCreationData.publicKeySha1 = clientCertificate.getPublicKeySha1();
        userCreationData.publicKeyChallengeRequest = fromBase64(request.challengeResponse.challenge);
        userCreationData.publicKeyChallengeResponse = fromBase64(request.challengeResponse.response);

        UserData user = identityService.createUser(userCreationData);

        RegisterResponse response = new RegisterResponse();
        response.userId = "" + user.getId();
        return response;
    }
View Full Code Here

TOP

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

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.