Package org.keycloak.representations.idm

Examples of org.keycloak.representations.idm.CredentialRepresentation


        // Credentials
        List<UserCredentialValueModel> creds = user.getCredentialsDirectly();
        List<CredentialRepresentation> credReps = new ArrayList<CredentialRepresentation>();
        for (UserCredentialValueModel cred : creds) {
            CredentialRepresentation credRep = exportCredential(cred);
            credReps.add(credRep);
        }
        userRep.setCredentials(credReps);
        userRep.setFederationLink(user.getFederationLink());
View Full Code Here


        socialLinkRep.setSocialUsername(socialLink.getSocialUsername());
        return socialLinkRep;
    }

    public static CredentialRepresentation exportCredential(UserCredentialValueModel userCred) {
        CredentialRepresentation credRep = new CredentialRepresentation();
        credRep.setType(userCred.getType());
        credRep.setDevice(userCred.getDevice());
        credRep.setHashedSaltedValue(userCred.getValue());
        credRep.setSalt(Base64.encodeBytes(userCred.getSalt()));
        credRep.setHashIterations(userCred.getHashIterations());
        return credRep;
    }
View Full Code Here

    public CredentialRepresentation regenerateSecret() {
        auth.requireManage();

        logger.debug("regenerateSecret");
        UserCredentialModel cred = KeycloakModelUtils.generateSecret(application);
        CredentialRepresentation rep = ModelToRepresentation.toRepresentation(cred);
        return rep;
    }
View Full Code Here

        }
        return rep;
    }

    public static CredentialRepresentation toRepresentation(UserCredentialModel cred) {
        CredentialRepresentation rep = new CredentialRepresentation();
        rep.setType(CredentialRepresentation.SECRET);
        rep.setValue(cred.getValue());
        return rep;
    }
View Full Code Here

        auth.requireManage();

        logger.debug("regenerateSecret");
        UserCredentialModel cred = UserCredentialModel.generateSecret();
        oauthClient.setSecret(cred.getValue());
        CredentialRepresentation rep = ModelToRepresentation.toRepresentation(cred);
        return rep;
    }
View Full Code Here

                }
                Response appCreateResponse = applicationsTarget.request().post(Entity.json(newApp));
                Assert.assertEquals(201, appCreateResponse.getStatus());
                appCreateResponse.close();
                WebTarget appTarget = applicationsTarget.path(appRep.getName());
                CredentialRepresentation cred = appTarget.path("client-secret").request().get(CredentialRepresentation.class);
                if (appRep.getSecret() != null) Assert.assertEquals(appRep.getSecret(), cred.getValue());
                CredentialRepresentation newCred = appTarget.path("client-secret").request().post(null, CredentialRepresentation.class);
                Assert.assertNotEquals(newCred.getValue(), cred.getValue());

                Response appUpdateResponse = appTarget.request().put(Entity.json(appRep));
                Assert.assertEquals(204, appUpdateResponse.getStatus());
                appUpdateResponse.close();
View Full Code Here

TOP

Related Classes of org.keycloak.representations.idm.CredentialRepresentation

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.