Hi,
Just to be sure we understand each other, pac4j-oauth library implements OAuth clients for various OAuth providers, using the authorization code grant type. So your OAuth provider must of course support this kind of grant type.
pac4j-oauth is built on top of
Scribe :
https://github.com/fernandezpablo85/scribe-java.
Scribehandles OAuth communication at a basic level : get request token, get authorization url (for authentication/authorization), get access token and sign requests (when calling the OAuh provider).
pac4j is a more generic and abstracted API on top of OAuth, OpenID, CAS, HTTP... supporting the global mechanism (on client side) :
- not authenticated, be redirected to the provider for authentication : getRedirectionUrl method
- after successful authentication, be redirected back to the application with credentials you extract :getCredentials method
- retrieve the user profile thanks to the credentials (and the OAuth provider) : getUserProfile method.
In pac4j, you will need to create two classes :
2) the user profile retrieved by the client. It has a definition of the attributes and their types.
I have two caveats though :
1) generally people implement new clients for existing web sites (url like
www.facebook.com) and I assume that your OAuth provider is only available locally (for example :
http://localhost:8080/oauthProvider). This means that you will a
Scribe Api with local urls. In this case, the base url certainly needs to be defined by configuration when you create the
Api in the init() method of the
pac4j-oauth Client (for production environment)
2) to retrieve the user profile, you need a "/profile" url, exposed by your OAuth provider to return the user attributes and identifier when requested with the access token (the JSON format is somehow a standard).
Hope it's clearer.
Best regards,
Jérôme