nuxeo/nuxeo-platform-login — pull request #3 by nelsonsilva (2013-03-27 09:44:54+00:00)
Title: OpenID Connect refactoring

In this PR I tried to make the OpenID Connect support more flexible so I added a couple more settings to the descriptor, namely:

- accessTokenKey: allows configuring the access token param name (some providers, like LinkedIn use a different token like oauth2_access_token)

- userResolverClass: allows configuring the UserResolver to use. I renamed the existing UserResolver to EmailBasedUserResolver and added a new one that's not used by default called StoredUserInfoResolver. This resolver uses a directory to store user info.

- redirectUriResolver: a class to setup the redirect uri (some providers do no support wildcards. I also added the possibility to setup a session attribute to control the redirect uri.

- userInfoClass: since most of the providers are still not according to the standard this allows mapping between the provided info and the standard

I also added the state param to prevent forgery and the OpenIDConnectAuthenticator sets a request attribute with the collected userinfo, this allows apps to provide automatic registration based on the existence of this info or connecting existing accounts, we're using this in a WebEngine application, ex:

```java
// Get the user info from the OpenID auth plugin
OpenIDUserInfo userInfo = (OpenIDUserInfo) request.getAttribute(OpenIDConnectAuthenticator.USERINFO_KEY);
OpenIDConnectProvider provider = getOpenIDConnectProvider(providerName);
UserResolver userResolver = provider.getUserResolver();
userResolver.updateUserInfo( (NuxeoPrincipal)principal).getModel(), userInfo);
```