Java Code Examples for org.keycloak.representations.idm.RealmRepresentation#setPublicKey()
The following examples show how to use
org.keycloak.representations.idm.RealmRepresentation#setPublicKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSpringBootTest.java From keycloak with Apache License 2.0 | 6 votes |
@Override public void addTestRealms(List<RealmRepresentation> testRealms) { RealmRepresentation realm = new RealmRepresentation(); realm.setId(REALM_ID); realm.setRealm(REALM_NAME); realm.setEnabled(true); realm.setPublicKey(REALM_PUBLIC_KEY); realm.setPrivateKey(REALM_PRIVATE_KEY); realm.setClients(Collections.singletonList(createClient())); List<String> eventListeners = new ArrayList<>(); eventListeners.add("jboss-logging"); eventListeners.add("event-queue"); realm.setEventsListeners(eventListeners); testRealms.add(realm); }
Example 2
Source File: CompositeImportRoleTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override public void addTestRealms(List<RealmRepresentation> testRealms) { RealmRepresentation testRealm = loadJson(getClass().getResourceAsStream("/testcomposite.json"), RealmRepresentation.class); testRealm.setId("test"); testRealm.setPublicKey("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB"); testRealm.setPrivateKey("MIICXAIBAAKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQABAoGAfmO8gVhyBxdqlxmIuglbz8bcjQbhXJLR2EoS8ngTXmN1bo2L90M0mUKSdc7qF10LgETBzqL8jYlQIbt+e6TH8fcEpKCjUlyq0Mf/vVbfZSNaVycY13nTzo27iPyWQHK5NLuJzn1xvxxrUeXI6A2WFpGEBLbHjwpx5WQG9A+2scECQQDvdn9NE75HPTVPxBqsEd2z10TKkl9CZxu10Qby3iQQmWLEJ9LNmy3acvKrE3gMiYNWb6xHPKiIqOR1as7L24aTAkEAtyvQOlCvr5kAjVqrEKXalj0Tzewjweuxc0pskvArTI2Oo070h65GpoIKLc9jf+UA69cRtquwP93aZKtW06U8dQJAF2Y44ks/mK5+eyDqik3koCI08qaC8HYq2wVl7G2QkJ6sbAaILtcvD92ToOvyGyeE0flvmDZxMYlvaZnaQ0lcSQJBAKZU6umJi3/xeEbkJqMfeLclD27XGEFoPeNrmdx0q10Azp4NfJAY+Z8KRyQCR2BEG+oNitBOZ+YXF9KCpH3cdmECQHEigJhYg+ykOvr1aiZUMFT72HU0jnmQe2FVekuG+LJUt2Tm7GtMjTFoGpf0JwrVuZN39fOYAlo+nTixgeW7X8Y="); testRealms.add(testRealm); }
Example 3
Source File: ClientTokenExchangeSAML2Test.java From keycloak with Apache License 2.0 | 5 votes |
@Override public void addTestRealms(List<RealmRepresentation> testRealms) { RealmRepresentation testRealmRep = new RealmRepresentation(); testRealmRep.setId(TEST); testRealmRep.setRealm(TEST); testRealmRep.setEnabled(true); testRealmRep.setPrivateKey(REALM_PRIVATE_KEY); testRealmRep.setPublicKey(REALM_PUBLIC_KEY); testRealmRep.setAccessCodeLifespan(60); // Used as default assertion lifespan testRealms.add(testRealmRep); }
Example 4
Source File: OIDCClientRegistrationTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override public void addTestRealms(List<RealmRepresentation> testRealms) { super.addTestRealms(testRealms); RealmRepresentation testRealm = testRealms.get(0); testRealm.setPrivateKey(PRIVATE_KEY); testRealm.setPublicKey(PUBLIC_KEY); ClientRepresentation samlApp = KeycloakModelUtils.createClient(testRealm, "saml-client"); samlApp.setSecret("secret"); samlApp.setServiceAccountsEnabled(true); samlApp.setDirectAccessGrantsEnabled(true); }
Example 5
Source File: KcSamlSignedBrokerTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override public RealmRepresentation createProviderRealm() { RealmRepresentation realm = super.createProviderRealm(); realm.setPublicKey(REALM_PUBLIC_KEY); realm.setPrivateKey(REALM_PRIVATE_KEY); return realm; }
Example 6
Source File: KcSamlSignedBrokerTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override public RealmRepresentation createConsumerRealm() { RealmRepresentation realm = super.createConsumerRealm(); realm.setPublicKey(REALM_PUBLIC_KEY); realm.setPrivateKey(REALM_PRIVATE_KEY); return realm; }
Example 7
Source File: KcSamlSignedDocumentOnlyBrokerTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override public RealmRepresentation createProviderRealm() { RealmRepresentation realm = super.createProviderRealm(); realm.setPublicKey(REALM_PUBLIC_KEY); realm.setPrivateKey(REALM_PRIVATE_KEY); return realm; }
Example 8
Source File: KcSamlSignedDocumentOnlyBrokerTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override public RealmRepresentation createConsumerRealm() { RealmRepresentation realm = super.createConsumerRealm(); realm.setPublicKey(REALM_PUBLIC_KEY); realm.setPrivateKey(REALM_PRIVATE_KEY); return realm; }
Example 9
Source File: RealmInvalidationClusterTest.java From keycloak with Apache License 2.0 | 5 votes |
@Override protected RealmRepresentation testEntityUpdates(RealmRepresentation realm, boolean backendFailover) { // realm name String originalName = realm.getRealm(); realm.setRealm(realm.getRealm() + "_updated"); realm = updateEntity(originalName, realm, getCurrentFailNode()); verifyEntityUpdateDuringFailover(realm, backendFailover); // enabled realm.setEnabled(!realm.isEnabled()); realm = updateEntityOnCurrentFailNode(realm, "enabled"); verifyEntityUpdateDuringFailover(realm, backendFailover); // public key realm.setPublicKey("GENERATE"); realm = updateEntityOnCurrentFailNode(realm, "public key"); assertNotEquals("GENERATE", realm.getPublicKey()); verifyEntityUpdateDuringFailover(realm, backendFailover); // require ssl realm.setSslRequired("all"); realm = updateEntityOnCurrentFailNode(realm, "require ssl"); verifyEntityUpdateDuringFailover(realm, backendFailover); // brute force detection realm.setBruteForceProtected(!realm.isBruteForceProtected()); realm = updateEntityOnCurrentFailNode(realm, "brute force"); verifyEntityUpdateDuringFailover(realm, backendFailover); // brute force detection - failure factor realm.setBruteForceProtected(true); realm.setFailureFactor(realm.getFailureFactor() + 1); realm = updateEntityOnCurrentFailNode(realm, "brute force failure factor"); verifyEntityUpdateDuringFailover(realm, backendFailover); return realm; }
Example 10
Source File: RealmManager.java From keycloak with Apache License 2.0 | 4 votes |
public void keyPair(String privateKey, String publicKey) { RealmRepresentation rep = realm.toRepresentation(); rep.setPrivateKey(privateKey); rep.setPublicKey(publicKey); realm.update(rep); }