openhab-core/itests/org.openhab.core.auth.oauth2client.tests
Markus Rathgeb b7b5dfc9fa POM Code Convention (#790)
There is a recommended ordering for all Maven POM files.
See: https://maven.apache.org/developers/conventions/code.html

The POM files has been "fixed" by using the "sortpom-maven-plugin".
The blank lines has been kept to keep the element separation for
readability.
The plugin also fixes indentation etc.
Have a look at: https://github.com/Ekryd/sortpom/wiki

The profile has been set to "recommended_2008_06" that states:
The POM Code Convention that was chosen by Maven developers in 2008

Command that has been executed:

    mvn \
      com.github.ekryd.sortpom:sortpom-maven-plugin:sort \
      -Dsort.keepBlankLines=true \
      -Dsort.predefinedSortOrder=recommended_2008_06

Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
2019-05-05 17:47:41 +02:00
..
src/main/java/org/eclipse/smarthome/auth/oauth2client/test/internal Use openHAB license headers (#632) 2019-03-06 16:10:00 +01:00
.classpath add some tests and prepare infrastructure (#531) 2019-02-05 09:32:49 +01:00
.project add some tests and prepare infrastructure (#531) 2019-02-05 09:32:49 +01:00
itest.bndrun Add required bundles to itests for successful Java 11 build (#685) 2019-03-31 17:53:56 +02:00
NOTICE Updated NOTICE files to openHAB (#578) 2019-02-15 10:46:18 +01:00
pom.xml POM Code Convention (#790) 2019-05-05 17:47:41 +02:00
README.md make a first step to split between pure JUnit and integration tests (#488) 2019-01-30 08:57:06 +01:00

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 smarthome oauth commands will be registered and ready to test.

Example 1: (Using authorization code)

Try these on the OSGI console:

smarthome oauth Code cleanupEverything
smarthome oauth Code create
smarthome oauth Code getClient <fill in handle from create step>
smarthome 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
smarthome oauth Code getAccessTokenByCode <code from redirectURL parameter>
smarthome oauth Code getCachedAccessToken
smarthome oauth Code refresh
smarthome 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:

smarthome oauth ResourceOwner create
smarthome oauth ResourceOwner getClient <fill in handle from create step>
smarthome oauth ResourceOwner getAccessTokenByResourceOwnerPassword
smarthome oauth ResourceOwner getCachedAccessToken
smarthome oauth ResourceOwner refresh
smarthome oauth ResourceOwner close

load again, similar to reboot/restart

smarthome oauth ResourceOwner getClient <fill in handle from create step>
smarthome oauth ResourceOwner getCachedAccessToken
smarthome oauth ResourceOwner refresh

Done playing, delete this service permanently

smarthome oauth ResourceOwner delete <fill in handle from create step>

Verify this is deleted (will throw exception)

smarthome oauth ResourceOwner getCachedAccessToken 

Cannot get the client after delete

smarthome oauth ResourceOwner getClient <fill in handle from create step>