{"repo":"TNG/keycloak-mock","free":true,"listed":false,"github":"https://github.com/TNG/keycloak-mock","clone":"git clone https://github.com/TNG/keycloak-mock.git","description":"A Java library to test REST endpoints secured by Keycloak via OpenID connect.","language":"Java","stars":135,"topics":["keycloak","mock","single-sign-on","testing"],"license":"Apache-2.0","category":"dev-tools","readme_excerpt":"Keycloak Mock Keycloak is a single sign-on solution that supports the Open ID connect standard. However, it does not deliver light-weight test support. This library is intended to fill that gap. All artifacts are available on Maven Central Repository with group ID com.tngtech.keycloakmock . Recent changes Have a look at our release notes for recent releases and changes. Testing authenticated backend calls When testing a REST backend that is protected by Keycloak, the mock allows to generate valid access tokens with configurable claims (e.g. roles). You can create and start the mock directly from the mock artifact using Maven or Gradle like this: You can also use the convenience wrapper mock-junit for JUnit4 or mock-junit5 for JUnit5 to let JUnit start the mock for you. You can then generate a token of your choosing by providing a TokenConfig: For a more in-detail test case, please have a look at the AuthenticationTest in our example backend project. Testing frontends and E2E flows In addition to generating and signing tokens programmatically, the mock also offers user login (using implicit or authorization code flow, including support for redirect to http://localhost and urn:ietf:wg:oauth:2.0:oob for desktop applications) client credentials authentication resource owner password credentials authentication (both for public and confidential clients) Note that as this is a mock, all flows are allowed for any client. For simplicity, all successful calls to the token endpoint retu","default_branch":null,"files":null,"tree":[],"storefront":"/r/TNG","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/TNG/keycloak-mock/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}