A simple library to provide keycloak support to GWT.
The simplest way to use the library is to add the following dependency into the build system. i.e.
<dependency>
<groupId>org.realityforge.gwt.keycloak</groupId>
<artifactId>gwt-keycloak</artifactId>
<version>0.1</version>
<scope>provided</scope>
</dependency>
Then you add the following snippet into the .gwt.xml file.
<module rename-to='myapp'>
...
<!-- Enable the websocket library -->
<inherits name="org.realityforge.gwt.keycloak.Keycloak"/>
</module>
Then you can interact with the WebSocket from within the browser.
final Keycloak keycloak = new Keycloak( "MyApp", "http://127.0.0.1:8080/myapp/keycloak.json" );
keycloak.setListener( new KeycloakListenerAdapter()
{
@Override
public void onReady( @Nonnull final Keycloak keycloak, final boolean authenticated )
{
if( authenticated )
{
//Start app here
}
else
{
keycloak.login();
}
}
} );
keycloak.init();
This should be sufficient to put together a simple Keycloak application.