Package org.keycloak.representations.idm

Examples of org.keycloak.representations.idm.OAuthClientRepresentation


        // OAuth clients
        List<OAuthClientModel> oauthClients = realm.getOAuthClients();
        List<OAuthClientRepresentation> oauthClientReps = new ArrayList<OAuthClientRepresentation>();
        for (OAuthClientModel oauthClient : oauthClients) {
            OAuthClientRepresentation clientRep = ModelToRepresentation.toRepresentation(oauthClient);
            clientRep.setSecret(oauthClient.getSecret());
            oauthClientReps.add(clientRep);
        }
        rep.setOauthClients(oauthClientReps);

        // Roles
View Full Code Here


        assertTrue(realm.oAuthClients().findAll().isEmpty());
    }

    @Test
    public void createOAuthClient() {
        OAuthClientRepresentation rep = new OAuthClientRepresentation();
        rep.setName("my-client");
        rep.setEnabled(true);
        realm.oAuthClients().create(rep);

        assertNames(realm.oAuthClients().findAll(), "my-client");
    }
View Full Code Here

    @Test
    public void getOAuthClientRepresentation() {
        createOAuthClient();

        OAuthClientRepresentation rep = realm.oAuthClients().get("my-client").toRepresentation();
        assertEquals("my-client", rep.getName());
        assertTrue(rep.isEnabled());
    }
View Full Code Here

        return rep;
    }

    public static OAuthClientRepresentation toRepresentation(OAuthClientModel model) {
        OAuthClientRepresentation rep = new OAuthClientRepresentation();
        rep.setId(model.getId());
        rep.setName(model.getClientId());
        rep.setEnabled(model.isEnabled());
        rep.setPublicClient(model.isPublicClient());
        rep.setProtocol(model.getProtocol());
        rep.setAttributes(model.getAttributes());
        rep.setFullScopeAllowed(model.isFullScopeAllowed());
        rep.setDirectGrantsOnly(model.isDirectGrantsOnly());
        Set<String> redirectUris = model.getRedirectUris();
        if (redirectUris != null) {
            rep.setRedirectUris(new LinkedList<String>(redirectUris));
        }

        Set<String> webOrigins = model.getWebOrigins();
        if (webOrigins != null) {
            rep.setWebOrigins(new LinkedList<String>(webOrigins));
        }
        rep.setNotBefore(model.getNotBefore());
        return rep;
    }
View Full Code Here

        boolean view = auth.hasView();
        for (OAuthClientModel oauth : oauthModels) {
            if (view) {
                rep.add(ModelToRepresentation.toRepresentation(oauth));
            } else {
                OAuthClientRepresentation client = new OAuthClientRepresentation();
                client.setName(oauth.getClientId());
                rep.add(client);
            }
        }
        return rep;
    }
View Full Code Here

TOP

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

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.