Create a Custom Login Module
Even though Kaazing Gateway provides several standard types of login-module implementations, you might choose to write a custom implementation. Because the JAAS interface implementation holds the authentication logic, most of the material you need to implement the LoginModule interface is provided in the following documentation:
- Java Authentication and Authorization Service (JAAS) LoginModule Developer’s Guide
- Interface LoginModule class (Java SE Developer’s Documentation)
- Kaazing Gateway Client API Documentation
Before You Begin
This optional procedure is part of Configure Authentication and Authorization:
- Configure the HTTP Challenge Scheme
- Configure a Chain of Login Modules
- Create a Custom Login Module (Optional)
- Integrate an Existing Custom Login Module into the Gateway (Optional)
- Configure a Challenge Handler on the Client
- Configure Authorization
To Configure Custom Login Modules
- Write the login module interface (
LoginContextAPI). - Write the
CallBackHandlerinterface that enables client to pass authentication data to the server. - Configure the
LoginModuleandCallBackHandlerwith the server and application. - Package the application along with module classes.
- Integrate the
LoginModulewith the application server.
- If you are using Kaazing Gateway 4.x SPIs and are upgrading to 5.x, update the SPI package names from
com.kaazing.gateway.server.spi.securitytoorg.kaazing.gateway.server.spi.security. - In Kaazing Gateway 4.x, custom login modules were stored in
GATEWAY_HOME/lib. For Kaazing Gateway 5.x, they are stored inGATEWAY_HOME/lib/ext. - The JAR file needed to develop your custom login module is
GATEWAY_HOME/lib/gateway.server.spi.jar. If you are also using LOG4J within your module, addGATEWAY_HOME/lib/slf4j-api-1.7.21.jar.
Next Steps
Integrate an Existing Custom Login Module into the Gateway