https://github.com/staffbase/plugins-sdk-java
Staffbase plugins SDK for Java
https://github.com/staffbase/plugins-sdk-java
Last synced: 11 months ago
JSON representation
Staffbase plugins SDK for Java
- Host: GitHub
- URL: https://github.com/staffbase/plugins-sdk-java
- Owner: Staffbase
- License: apache-2.0
- Created: 2017-03-10T14:07:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-01T12:00:26.000Z (almost 2 years ago)
- Last Synced: 2024-08-01T12:52:30.463Z (almost 2 years ago)
- Language: Java
- Homepage:
- Size: 188 KB
- Stars: 5
- Watchers: 33
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Authors: AUTHORS.txt
Awesome Lists containing this project
README
[](https://github.com/Staffbase/plugins-sdk-java/actions)
# Plugin SDK for Java
If you are developing your own plugin for your Staffbase app we describe the authentication flow of a plugin at https://developers.staffbase.com/guide/customplugin-overview/. While the official documentation covers only the conceptual aspects of the plugins – the so called Plugin SSO – we want to provide a library to help you develop your first plugin for Staffbase even faster. This SDK provides the basic functionality to parse and verify a provided token for Java.
## Installation
We provide our Plugin SDK via Maven Central Repository (https://repo1.maven.org/maven2/com/staffbase/plugins-sdk-java/). Thus, you can just use maven for installation:
### Maven
```xml
com.staffbase
plugins-sdk-java
1.2.9
```
### Gradle
```
dependencies {
implementation 'com.staffbase:plugins-sdk-java:1.2.9'
}
```
## API Reference
For the API reference of this SDK please consult the [docs](https://staffbase.github.io/plugins-sdk-java).
## Code Example
You can try to create a token from the received jwt.
```java
import com.staffbase.plugins.sdk.sso.SSOData;
import com.staffbase.plugins.sdk.sso.SSOFacade;
...
String jwToken = ...
RSAPublicKey rsaPublicKey = ...
try {
// Create the SSO handler with your RSA public key
final SSOFacade ssoFac = SSOFacade.create(rsaPublicKey);
// Verify and decode the JWT token
final SSOData ssoData = ssoFac.verify(jwToken);
// If the plugin instance was deleted in Staffbase
if(ssoData.isDeleteInstanceCall()){
this.handleSsoDeletionCall(ssoData.getInstanceID());
return;
}
request.setAttribute("instanceID", ssoData.getInstanceID());
return this.forward("/index.jsp");
} catch (final SSOException ssoException) {
if (logger.isErrorEnabled()) {
logger.error("Verification of SSO attempt failed. Aborting.", ssoException);
}
return this.forward("/errors/403-Forbidden.jsp");
}
```
## Contribution
- Fork it
- Create a branch `git checkout -b feature-description`
- Put your name into authors.txt
- Commit your changes `git commit -am "Added ...."`
- Push to the branch `git push origin feature-description`
- Open a Pull Request
## Running Tests
To run the tests a simple `# mvn test` command in the root directory will suffice.
## License
Copyright 2017-2025 Staffbase SE.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0