mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 21:31:53 +01:00
873bb53cbc
* Upgrade Karaf from 4.4.5 to 4.4.6 * Sync runtime dependencies with Karaf 4.4.6, most notably: * Jetty 9.4.54.v20240208, addresses CVE-2024-22201 * Pax Logging 2.2.7 * Pax Web 8.0.27 * ASM 9.7 * BouncyCastle 1.77 * Upgrade xtext to 2.35.0.M1 * Resolve itest runbundles Signed-off-by: Holger Friedrich <mail@holger-friedrich.de> |
||
---|---|---|
.. | ||
src/main/java/org/openhab/core/auth/oauth2client/test/internal | ||
.classpath | ||
.project | ||
itest.bndrun | ||
NOTICE | ||
pom.xml | ||
README.md |
This is a working bundle for demonstrating/ testing the OAuth2 client. Passwords, secrets, etc have to be configured through config admin in order for it to work
Simply deploy it to the runtime; then openhab:oauth commands will be registered and ready to test.
Example 1: (Using authorization code)
Try these on the OSGI console:
openhab:oauth Code cleanupEverything
openhab:oauth Code create
openhab:oauth Code getClient <fill in handle from create step>
openhab:oauth Code getAuthorizationUrl
now open browser with the URL from above step, authenticate yourself
to a real oauth provider
if everything works properly, it should redirect you to your redirectURL
Read the code http parameter from the redirectURL
openhab:oauth Code getAccessTokenByCode <code from redirectURL parameter>
openhab:oauth Code getCachedAccessToken
openhab:oauth Code refresh
openhab:oauth Code close
Example 2: (Using ResourceOwner credentials i.e. you have the user's username and password directly)
Try these on the OSGI console:
openhab:oauth ResourceOwner create
openhab:oauth ResourceOwner getClient <fill in handle from create step>
openhab:oauth ResourceOwner getAccessTokenByResourceOwnerPassword
openhab:oauth ResourceOwner getCachedAccessToken
openhab:oauth ResourceOwner refresh
openhab:oauth ResourceOwner close
load again, similar to reboot/restart
openhab:oauth ResourceOwner getClient <fill in handle from create step>
openhab:oauth ResourceOwner getCachedAccessToken
openhab:oauth ResourceOwner refresh
Done playing, delete this service permanently
openhab:oauth ResourceOwner delete <fill in handle from create step>
Verify this is deleted (will throw exception)
openhab:oauth ResourceOwner getCachedAccessToken
Cannot get the client after delete
openhab:oauth ResourceOwner getClient <fill in handle from create step>