oltu-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saqib Ali <saqib.n....@seagate.com>
Subject Re: Google OpenID Connect Authentication example
Date Fri, 20 Mar 2015 16:22:43 GMT
 Ashwanth,

Thanks for the response. Can you please tell me what maven artifacts and
imports I need to use to run this code?

Thanks! :)

On Tue, Mar 17, 2015 at 8:53 AM, Tiburtius, Ashwanth [IWD] <
Ashwanth.Tiburtius@iwd.iowa.gov> wrote:

> Hi Saqib,
>
>
>
> See if this helps:
>
>
>
> Build request to redirect to Google.
>
>
>
> OAuthClientRequest request =
> OAuthClientRequest.authorizationProvider(OAuthProviderType.*GOOGLE*)
>
>                                                 .setClientId(Constants.
> *G_CLIENT_ID*
>
>                                                 .setResponseType(OAuth.
> *OAUTH_CODE*)
>
>                                                 .setScope(Constants.
> *G_SCOPE*)
>
>                                                 .setRedirectURI(Constants.
> *OAUTH_REDIRECT_URL*)
>
>                                                 buildQueryMessage();
>
>
>
> Redirect to request.getLocationUri()
>
>
>
> Get the auth code returned from Google after user signs in.
>
> Get access token using the following.
>
> OAuthClientRequest oAuthClientRequest = OAuthClientRequest.*tokenProvider*
> (OAuthProviderType.*GOOGLE*)
>
>
> .setGrantType(GrantType.*AUTHORIZATION_CODE*)
>
>
> .setClientId(Constants.*G_CLIENT_ID*)
>
>
> .setClientSecret(Constants.*G_CLIENT_SECRET*)
>
>
> .setRedirectURI(Constants.*OAUTH_REDIRECT_URL*)
>
>
> .setCode(*this*.code).buildBodyMessage();
>
>
>
> *final* OAuthAccessTokenResponse accessTokenResponse = oAuthClient
> .accessToken(oAuthClientRequest);
>
> accessToken = accessTokenResponse.getAccessToken();
>
>
>
> Get User info using the following.
>
>
> *final* OAuthClientRequest bearerClientRequest = *new*
> OAuthBearerClientRequest(Constants.*G_USERINFO_URL*)
>
>
> .setAccessToken(accessToken)
>
>
> .buildHeaderMessage();
>
>
>
> OAuthResourceResponse resourceResponse = oAuthClient.resource(
> bearerClientRequest,
>
> OAuth.HttpMethod.*GET*, OAuthResourceResponse.*class*);
>
> resourceResponse.getBody()
>
>
>
>
>
> Regards,
>
> Jude.
>
> Iowa Workforce Development – IT | 1000 E Grand Ave, Des Moines, IA  50319
>
> (515) 281-3378 | Ashwanth.Tiburtius@iwd.iowa.gov
>
>
>
> *From:* Saqib Ali [mailto:saqib.n.ali@seagate.com]
> *Sent:* Monday, March 16, 2015 8:20 PM
> *To:* user@oltu.apache.org
> *Subject:* Google OpenID Connect Authentication example
>
>
>
> Greetings,
>
>
>
> Can anyone please send me a Google OpenID Connect Authentication example
> using the Oltu Open Connect library?
>
>
>
> Thanks! :)
>

Mime
View raw message