Package io.fathom.cloud.server.resources

Examples of io.fathom.cloud.server.resources.ClientCertificate


        boolean hasChallengeResponse = false;
        if (authRequest.challengeResponse != null && !Strings.isNullOrEmpty(authRequest.challengeResponse.challenge)) {
            hasChallengeResponse = true;
        }

        ClientCertificate clientCertificate = getClientCertificate();

        if (!hasPasswordCredentials) {
            if (!hasChallengeResponse) {
                if (clientCertificate != null) {
                    // Request for challenge
View Full Code Here


        if (Strings.isNullOrEmpty(email)) {
            throw new IllegalArgumentException();
        }
        email = email.trim();

        ClientCertificate clientCertificate = getClientCertificate();
        if (clientCertificate == null) {
            throw new IllegalArgumentException("Client certificate not provided");
        }

        if (request.challengeResponse == null || Strings.isNullOrEmpty(request.challengeResponse.response)) {
            ByteString challenge = loginService.createRegistrationChallenge(clientCertificate);

            RegisterResponse response = new RegisterResponse();
            response.challenge = BaseEncoding.base64().encode(challenge.toByteArray());
            return response;
        }

        DomainData domain = identityService.getDefaultDomain();

        UserData.Builder b = UserData.newBuilder();

        // We allow multiple systems to share an email address
        // so we use the public key hash as our unique id
        {
            ByteString publicKeySha1 = clientCertificate.getPublicKeySha1();
            String hex = BaseEncoding.base16().encode(publicKeySha1.toByteArray());
            b.setName("__pubkey__" + hex);
        }

        b.setDomainId(domain.getId());

        b.setEnabled(true);

        b.setEmail(request.email);

        String password = null;
        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);
View Full Code Here

TOP

Related Classes of io.fathom.cloud.server.resources.ClientCertificate

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.