1.0.3 • Published 3 years ago
@meveo-org/mv-keycloak v1.0.3
mv-keycloak
MvKeycloak is a Meveo component (based on lit-element) that allows meveo page components to be secured by Keycloak.
Features
- Written in vanilla javascript
- Simplifies keycloak integration with page components
Quick Start
To use MvKeycloak component:
- Clone this repo.
- Run keycloak standalone or via docker using the included
docker-compose.yml
file. - Serve the project from the root directory with some http server (best served with meveo itself)
- Download the Keycloak OIDC JSON configuration file as described here https://www.keycloak.org/docs/latest/authorization_services/#obtaining-the-adapter-configuration
- Copy the
keycloak.json
file obtained from step 3 into the project directory. Import
mv-keycloak
into the page and wrap the page component with themv-keycloak
tag. e.g.<mv-keycloak settings-path="./keycloak.json" @auth-success="${this.handleLogin}" @auth-fail="${this.handleLoginFail}" @auth-init-fail="${this.handleLoginFail}" > <h1>This is a secure page</h1> <button @click="${this.handleLogout}">Logout</button> <div slot="loading">This message is shown while loading...</div> <div slot="authenticating"> This message is shown while authenticating... </div> <div slot="failed">This message is shown when authentication fails</div> </mv-keycloak>
Acknowledgements
- Uses Keycloak