        OAuth 2.0 Resource Owner Credential Flow - Client Example


This sample demonstrates how to use OAuth 2.0 Resource Owner
Credential Flow flow to communicate with Idenity Provider
(Authorization Server).

This sample is implemented as simple Java Swing based application.
The logic can be used with any thick desktop clients, mobile
applications or even server hosted web applications.

The Resource Owner Credential flows should be used when there is no
other alternative flows that can be conveniently used.  Since, the
user has to share password credentials with the client applications,
this should be used at places where users have high trust on client
applications. 


This sample application uses Google OAuth Client API for Resource Owner 
Credential token request  to retrieve token from Identity Provider 
(Authorization Server) token end-point. 

The OAuth2 Resource Owner Credential Flow requires username,user's passowrd, 
client ID and client secret to get token from Identity Provider 
(Authorization Server) token end-point.  

Pre-Requisites
==============
This sample assumes the expertise with the following technologies

* Java 1.8
* Maven for building and dependency management
* Java Swing UI

Compile
=======
Maven has to be installed to compile and run the example.  Download
maven from http://maven.apache.org/download.cgi and invoke the
following steps

set the JAVA_HOME to Java SDK version 1.8 path

1. edit the file under src/main/resources/oauth.properties. Change the
endpoints to point to an actual implementation of NetIQ Access Manager
Identity Provider.

2. runt the following command
   mvn install

This will compile the sample, package & install in local repository

Run
===

1. issue the following command

mvn exec:java

This will open a Java Swing window.  You can enter username and
password. Clicking "Get Token Details" will fetch "OAuth 2.0 Access
Token" using Resource Owner Credential Flow and display the resultant
json.
