Return-Path: X-Original-To: apmail-oltu-user-archive@www.apache.org Delivered-To: apmail-oltu-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EDBC117F98 for ; Fri, 20 Mar 2015 16:24:28 +0000 (UTC) Received: (qmail 19011 invoked by uid 500); 20 Mar 2015 16:24:28 -0000 Delivered-To: apmail-oltu-user-archive@oltu.apache.org Received: (qmail 18981 invoked by uid 500); 20 Mar 2015 16:24:28 -0000 Mailing-List: contact user-help@oltu.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@oltu.apache.org Delivered-To: mailing list user@oltu.apache.org Received: (qmail 18971 invoked by uid 99); 20 Mar 2015 16:24:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Mar 2015 16:24:28 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of saqib.n.ali@seagate.com designates 67.231.152.68 as permitted sender) Received: from [67.231.152.68] (HELO mx0b-00003501.pphosted.com) (67.231.152.68) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Mar 2015 16:24:02 +0000 Received: from pps.filterd (m0075034.ppops.net [127.0.0.1]) by mx0b-00003501.pphosted.com (8.14.5/8.14.5) with SMTP id t2KGKHo9006236 for ; Fri, 20 Mar 2015 12:22:44 -0400 Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx0b-00003501.pphosted.com with ESMTP id 1t8pbmr55k-6 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Fri, 20 Mar 2015 12:22:44 -0400 Received: by mail-la0-f43.google.com with SMTP id e2so15609066lab.3 for ; Fri, 20 Mar 2015 09:22:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=CqR/VUR/bIxdlJcHqg6Nl2VCorbmTZwTHTRnVVvRAn4=; b=Tj7+EX35ksIaxqvoAKRP9hkSOUfY4hiMEWaFlEPaDPuHHKlrJhnBcpeY1bZ64Etsds Rvi9gDdUbjHA3EgDJo/JqMZjqBygC/cyzOK6a3hWPEVTd1dpvxAXyIGW39XH8yvoTP2K eFO8gk8/Q/lDK6cfUJAqnNWt3mMYEyMypS1yHVJyRDUeeX7eWCPZC9HcdJbLIS8G+6Cy kiMA9DbdXL6dDktEskan94gldNn99JM+7SmeY88XDZdgP8hkNBo+l9jVQb4I4titrJVT lj4SfKi3CrRbXKwSHZH7JieTl9qFQCBvitv2hP5N2xLQ4AlH+JdbB3alEU5VIDRIKI2a PeGA== X-Gm-Message-State: ALoCoQnMw4V5M7x/4pFBNdLH+j5TmfGgPDIT6Uxr1GZ9OCk6vbPy1d0n0ffg0yPf9h+xAKGywNedUxxg1SvtrdTRcUtcAcuFu425sgxq6EfEvPpW1Y1D6HzPx89aSwS4OAc1d18yqlYlbI2skPEExbyl/jOANmwdmw== X-Received: by 10.112.131.66 with SMTP id ok2mr70351711lbb.51.1426868563845; Fri, 20 Mar 2015 09:22:43 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.131.66 with SMTP id ok2mr70351703lbb.51.1426868563675; Fri, 20 Mar 2015 09:22:43 -0700 (PDT) Received: by 10.152.1.168 with HTTP; Fri, 20 Mar 2015 09:22:43 -0700 (PDT) In-Reply-To: References: Date: Fri, 20 Mar 2015 09:22:43 -0700 Message-ID: Subject: Re: Google OpenID Connect Authentication example From: Saqib Ali To: user@oltu.apache.org Content-Type: multipart/alternative; boundary=047d7b33dbd6e127290511bab955 X-Proofpoint-PolicyRoute: Outbound X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-03-20_06:2015-03-20,2015-03-20,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 kscore.is_bulkscore=0 kscore.compositescore=0.999999999999999 circleOfTrustscore=0 compositescore=0.000575096700145192 suspectscore=3 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.000575096700145192 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.000575096700145192 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1503200167 X-Virus-Checked: Checked by ClamAV on apache.org --047d7b33dbd6e127290511bab955 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 =3D > 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 =3D OAuthClientRequest.*tokenProvid= er* > (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 =3D oAuthClient > .accessToken(oAuthClientRequest); > > accessToken =3D accessTokenResponse.getAccessToken(); > > > > Get User info using the following. > > > *final* OAuthClientRequest bearerClientRequest =3D *new* > OAuthBearerClientRequest(Constants.*G_USERINFO_URL*) > > > .setAccessToken(accessToken) > > > .buildHeaderMessage(); > > > > OAuthResourceResponse resourceResponse =3D oAuthClient.resource( > bearerClientRequest, > > OAuth.HttpMethod.*GET*, OAuthResourceResponse.*class*); > > resourceResponse.getBody() > > > > > > Regards, > > Jude. > > Iowa Workforce Development =E2=80=93 IT | 1000 E Grand Ave, Des Moines, I= A 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! :) > --047d7b33dbd6e127290511bab955 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
=C2=A0Ashwanth,

Thanks for the resp= onse. 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.iow= a.gov> wrote:

Hi Saqib,

=C2=A0

See if this helps:

=C2=A0

Build request to redirect to Google.=

=C2= =A0

<= span style=3D"font-size:10.0pt;font-family:Consolas;color:black">OAuthClien= tRequest request =3D OAuthClientRequest.authorizationProvider(OAuthProvider= Type.GOOGLE)

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0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=A0 .setRedirectURI(Constants.OAUTH_REDIRECT_URL<= /b>)

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 buildQueryMessage();

=C2= =A0

Redirect to request.getLocationUri()<= /u>

=C2=A0

Get the auth code returned from Google= after user signs in.

Get access token using the following.<= /p>

OAuthClientRequest oAuthClie= ntRequest =3D OAuthClientRequest.tokenProvider(OAuthProviderType.GOOGLE)=

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 .setGrantType(GrantType.AUTHORIZATION_CODE= )=

=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0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0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .set= RedirectURI(Constants.OAUTH_REDIRECT_URL)

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .setCode(t= his.code).buildBodyMessage();

= =C2=A0

final OAuthAccessTokenResponse accessTokenResponse =3D oAuthClient= .accessTo= ken(oAuthClientRequest);

accessToken =3D accessTokenResponse.getAccessToken();

=C2=A0

Get User info using the following. =C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0

final OAuthClientRequest bearerClien= tRequest =3D new OAuthBearerClientRequest(Constants.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=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0

OAut= hResourceResponse resourceResponse =3D oAuthClient= .resource= (bearerClientRequest,

OAuth.HttpMethod.GET, OAuthResourceResponse.cl= ass);=C2=A0=C2=A0=C2=A0

resourceResponse.getBody()

=C2=A0

=C2=A0

Regards,

<= p class=3D"MsoNormal">Jude.

<= p class=3D"MsoNormal">Iowa Workforce Development =E2= =80=93 IT | 1000 E Grand Ave, Des Moines, IA=C2=A0 50319

(515) 281-3378 | = Ashwanth.Tiburtius@iwd.iowa.gov

= =C2=A0

From:<= /b> Saqib Ali [mailto:saqib.n.ali@seagate.com]
Sent: Monday, M= arch 16, 2015 8:20 PM
To: user@oltu.apache.org
Subject: Google OpenI= D Connect Authentication example

<= p class=3D"MsoNormal">=C2=A0

<= span style=3D"font-size:9.5pt">Greetings,

=C2=A0

Ca= n anyone please send me a Google OpenID Connect Authentication example usin= g the Oltu Open Connect library?

=C2=A0=

Thank= s! :)

<= /div>
--047d7b33dbd6e127290511bab955--