keycloak-scim/testsuite/integration
Michael Gerber 144ee2c56d add localization support to realm
(cherry picked from commit b00764b)

add localization support to realm
(cherry picked from commit b00764b)

add localization support to realm
(cherry picked from commit b00764b)

admin gui for localization support
(cherry picked from commit c157cc3)

added locale support to ClassLoaderTheme and FolderTheme
(cherry picked from commit 764960a)

rename localizatin to internationalization
(cherry picked from commit 74a0658)

fallback if no message can be found
(cherry picked from commit 2d54e6f)

fallback if no message can be found
(cherry picked from commit 2d54e6f)

add HttpHeaders
(cherry picked from commit be921c8)

add HttpHeaders
(cherry picked from commit be921c8)

NPE fix
(cherry picked from commit 148158b)

improve locale helper
(cherry picked from commit 57a805a)

write cookie
fix npe
(cherry picked from commit 33398b3)

dropdown to choose language
(cherry picked from commit 9e2eb60)

added dropdown to choose locale to the account page.
fixed the path of the cookie.
(cherry picked from commit 871469a)

remove debug info
(cherry picked from commit c3ea6b1)

added dropdown to change locale for user.
(cherry picked from commit 1575bea)

add i18n for emails
(cherry picked from commit b6280e9)

i18n for emails
(cherry picked from commit 6118c51)

set default locale to english
(cherry picked from commit 386447b)

change locale type form String to Locale
(cherry picked from commit 8dcc595)

change file encoding
(cherry picked from commit 2cce96d)

added parameters to setSuccess, setWarning, setError
(cherry picked from commit 64ea438)

i18n for error messages
(cherry picked from commit e75d5ef)

i18n for error message in login
(cherry picked from commit 8b60c96)

add i18n for messages in account pages
(cherry picked from commit 9849d94)

fix unit test
(cherry picked from commit a70a1c7)

fix unit test
(cherry picked from commit 008744b)

locale localization :)
(cherry picked from commit f3a2144)

locale localization :)
(cherry picked from commit 21f6384)

messages refactoring
(cherry picked from commit 08f1ae7)

messages refactoring
(cherry picked from commit 3b4b53a)

messages refactoring
(cherry picked from commit 69146d4)

messages refactoring
(cherry picked from commit cd3db1d)

messages refactoring
(cherry picked from commit 715583f)

fix unit tests after message refactoring
(cherry picked from commit a82c9ff)

fix unit tests after message refactoring
(cherry picked from commit 5662d83)

fix unit tests after message refactoring
(cherry picked from commit 1188de6)

fix unit tests after message refactoring
(cherry picked from commit 90ded07)

German translations
(cherry picked from commit 9822b99)

removed newliines
(cherry picked from commit 34ca1d8)

removed java 8 dependency
(cherry picked from commit 3a23f4f)

typo
(cherry picked from commit a818122)

typo
(cherry picked from commit a818122)

forgotten properties

unit test fixes

unit test fixes

fixes after rebase

add localization support to realm
(cherry picked from commit b00764b)

add localization support to realm
(cherry picked from commit b00764b)

add localization support to realm
(cherry picked from commit b00764b)

admin gui for localization support
(cherry picked from commit c157cc3)

added locale support to ClassLoaderTheme and FolderTheme
(cherry picked from commit 764960a)

rename localizatin to internationalization
(cherry picked from commit 74a0658)

fallback if no message can be found
(cherry picked from commit 2d54e6f)

fallback if no message can be found
(cherry picked from commit 2d54e6f)

add HttpHeaders
(cherry picked from commit be921c8)

add HttpHeaders
(cherry picked from commit be921c8)

NPE fix
(cherry picked from commit 148158b)

improve locale helper
(cherry picked from commit 57a805a)

write cookie
fix npe
(cherry picked from commit 33398b3)

dropdown to choose language
(cherry picked from commit 9e2eb60)

added dropdown to choose locale to the account page.
fixed the path of the cookie.
(cherry picked from commit 871469a)

remove debug info
(cherry picked from commit c3ea6b1)

added dropdown to change locale for user.
(cherry picked from commit 1575bea)

add i18n for emails
(cherry picked from commit b6280e9)

i18n for emails
(cherry picked from commit 6118c51)

set default locale to english
(cherry picked from commit 386447b)

change locale type form String to Locale
(cherry picked from commit 8dcc595)

change file encoding
(cherry picked from commit 2cce96d)

added parameters to setSuccess, setWarning, setError
(cherry picked from commit 64ea438)

i18n for error messages
(cherry picked from commit e75d5ef)

i18n for error message in login
(cherry picked from commit 8b60c96)

add i18n for messages in account pages
(cherry picked from commit 9849d94)

fix unit test
(cherry picked from commit a70a1c7)

fix unit test
(cherry picked from commit 008744b)

locale localization :)
(cherry picked from commit f3a2144)

locale localization :)
(cherry picked from commit 21f6384)

messages refactoring
(cherry picked from commit 08f1ae7)

messages refactoring
(cherry picked from commit 3b4b53a)

messages refactoring
(cherry picked from commit 69146d4)

messages refactoring
(cherry picked from commit cd3db1d)

messages refactoring
(cherry picked from commit 715583f)

fix unit tests after message refactoring
(cherry picked from commit a82c9ff)

fix unit tests after message refactoring
(cherry picked from commit 5662d83)

fix unit tests after message refactoring
(cherry picked from commit 1188de6)

fix unit tests after message refactoring
(cherry picked from commit 90ded07)

German translations
(cherry picked from commit 9822b99)

removed newliines
(cherry picked from commit 34ca1d8)

removed java 8 dependency
(cherry picked from commit 3a23f4f)

typo
(cherry picked from commit a818122)

typo
(cherry picked from commit a818122)

forgotten properties

unit test fixes

unit test fixes

fixes after rebase

fixes after rebase

fixes after rebase

fixes after rebase
2015-03-14 14:08:06 +01:00
..
src add localization support to realm 2015-03-14 14:08:06 +01:00
pom.xml Update documentation for JSON File persistence of the model. 2015-03-10 04:42:20 +01:00
README.md Kerberos documentation 2015-02-27 13:48:40 +01:00

Executing testsuite

Browser

The testsuite uses Sellenium. By default it uses the HtmlUnit WebDriver, but can also be executed with Chrome or Firefox.

To run the tests with Firefox add -Dbrowser=firefox or for Chrome add -Dbrowser=chrome

Mongo

The testsuite is executed with JPA model implementation with data saved in H2 database by default. To run testsuite with Mongo model, just add property -Dkeycloak.realm.provider=mongo when executing it. This single property will cause that mongo will be used for realm-model, user-model and audit.

Note that this will automatically run embedded Mongo database on localhost/27018 and it will stop it after whole testsuite is finished. So you don't need to have Mongo installed on your laptop to run mongo execution tests.

Test utils

Keycloak server

To start a basic Keycloak server for testing run:

mvn exec:java -Pkeycloak-server

or run org.keycloak.testutils.KeycloakServer from your favourite IDE!

When starting the server it can also import a realm from a json file:

mvn exec:java -Pkeycloak-server -Dimport=testrealm.json

Live edit of html and styles

The Keycloak test server can load resources directly from the filesystem instead of the classpath. This allows editing html, styles and updating images without restarting the server. To make the server use resources from the filesystem start with:

mvn exec:java -Pkeycloak-server -Dresources

You can also specify the theme directory used by the server with:

mvn exec:java -Pkeycloak-server -Dkeycloak.theme.dir=<PATH TO THEMES DIR>

For example to use the example themes run the server with:

mvn exec:java -Pkeycloak-server -Dkeycloak.theme.dir=examples/themes

NOTE: If keycloak.theme.dir is specified the default themes (base, rcue and keycloak) are loaded from the classpath

Run server with Mongo model

To start a Keycloak server with identity model data persisted in Mongo database instead of default JPA/H2 you can run:

mvn exec:java -Pkeycloak-server -Dkeycloak.realm.provider=mongo -Dkeycloak.user.provider=mongo -Dkeycloak.audit.provider=mongo

By default it's using database keycloak on localhost/27017 and it uses already existing data from this DB (no cleanup of existing data during bootstrap). Assumption is that you already have DB running on localhost/27017 . Use system properties to configure things differently:

mvn exec:java -Pkeycloak-server -Dkeycloak.realm.provider=mongo -Dkeycloak.user.provider=mongo -Dkeycloak.eventStore.provider=mongo -Dkeycloak.connectionsMongo.host=localhost -Dkeycloak.connectionsMongo.port=27017 -Dkeycloak.connectionsMongo.db=keycloak -Dkeycloak.connectionsMongo.clearOnStartup=false

Note that if you are using Mongo model, it would mean that Mongo will be used for audit as well. You may need to use audit related properties for configuration of Mongo if you want to override default ones (For example keycloak.audit.mongo.host, keycloak.audit.mongo.port etc)

TOTP codes

To generate totp codes without Google authenticator run:

mvn exec:java -Ptotp

or run org.keycloak.testutils.TotpGenerator from your favourite IDE!

Once started copy/paste the totp secret and press enter. To use a new secret just copy/paste and press enter again.

Mail server

To start a test mail server for testing email sending run:

mvn exec:java -Pmail-server

or run org.keycloak.testutils.MailServer from your favourite IDE!

To configure Keycloak to use the above server add the following system properties:

keycloak.mail.smtp.from=auto@keycloak.org
keycloak.mail.smtp.host=localhost
keycloak.mail.smtp.port=3025

For example if using the test utils Keycloak server start it with:

mvn exec:java -Pkeycloak-server -Dkeycloak.mail.smtp.from=auto@keycloak.org -Dkeycloak.mail.smtp.host=localhost -Dkeycloak.mail.smtp.port=3025

LDAP server

To start a ApacheDS based LDAP server for testing LDAP sending run:

mvn exec:java -Pldap

There are additional system properties you can use to configure (See EmbeddedServersFactory class for details). Once done, you can create LDAP Federation provider in Keycloak admin console with the settings like:

  • Vendor: Other
  • Connection URL: ldap://localhost:10389
  • Base DN: dc=keycloak,dc=org
  • User DN Suffix: ou=People,dc=keycloak,dc=org
  • Bind DN: uid=admin,ou=system
  • Bind credential: secret

Kerberos server

To start a ApacheDS based Kerberos server for testing Kerberos + LDAP sending run:

mvn exec:java -Pkerberos

There are additional system properties you can use to configure (See EmbeddedServersFactory class for details) but for testing purposes default values should be good. By default ApacheDS LDAP server will be running on localhost:10389 and Kerberos KDC on localhost:6088 . LDAP will import initial data from src/main/resources/kerberos/users-kerberos.ldif .

Once kerberos is running, you can create LDAP Federation provider in Keycloak admin console with same settings like mentioned in previous LDAP section. But additionally you can enable Kerberos authentication in LDAP provider with the settings like:

  • Kerberos realm: KEYCLOAK.ORG
  • Server Principal: HTTP/localhost@KEYCLOAK.ORG
  • KeyTab: $KEYCLOAK_SOURCES/testsuite/integration/src/main/resources/kerberos/http.keytab (Replace $KEYCLOAK_SOURCES with correct absolute path of your sources)

Once you do this, you should also ensure that your Kerberos client configuration file is properly configured with KEYCLOAK.ORG domain. See src/main/resources/kerberos/test-krb5.conf for inspiration. The location of Kerberos configuration file is platform dependent (In linux it's file /etc/krb5.conf )

Then you need to configure your browser to allow SPNEGO/Kerberos login from localhost .

Exact steps are again browser dependent. For Firefox see for example http://www.microhowto.info/howto/configure_firefox_to_authenticate_using_spnego_and_kerberos.html . URI localhost must be allowed in network.negotiate-auth.trusted-uris config option.

For Chrome, you just need to run the browser with command similar to this (more details in Chrome documentation):

/usr/bin/google-chrome-stable --auth-server-whitelist="localhost"

Finally test the integration by retrieve kerberos ticket. In many OS you can achieve this by running command from CMD like:

kinit hnelson@KEYCLOAK.ORG

and provide password secret

Now when you access http://localhost:8081/auth/realms/master/account you should be logged in automatically as user hnelson .