cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6165] Adding the initial demo code, will be finished over the next several months or so
Date Thu, 18 Dec 2014 15:29:48 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 33fcf44d3 -> 5bac26a13


[CXF-6165] Adding the initial demo code, will be finished over the next several months or
so


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5bac26a1
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5bac26a1
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5bac26a1

Branch: refs/heads/master
Commit: 5bac26a132e7999bf0bd108d4cffb674873a56ca
Parents: 33fcf44
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Thu Dec 18 15:29:32 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Thu Dec 18 15:29:32 2014 +0000

----------------------------------------------------------------------
 .../release/samples/jax_rs/big_query/pom.xml    | 114 +++++++++++++
 .../java/demo/jaxrs/server/BigQueryService.java | 164 +++++++++++++++++++
 .../main/webapp/WEB-INF/applicationContext.xml  | 121 ++++++++++++++
 .../src/main/webapp/WEB-INF/servicestore.jks    | Bin 0 -> 3350 bytes
 .../big_query/src/main/webapp/WEB-INF/web.xml   |  39 +++++
 .../jax_rs/big_query/src/main/webapp/index.html |  59 +++++++
 6 files changed, 497 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/5bac26a1/distribution/src/main/release/samples/jax_rs/big_query/pom.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/big_query/pom.xml b/distribution/src/main/release/samples/jax_rs/big_query/pom.xml
new file mode 100644
index 0000000..68c799c
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/big_query/pom.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+ 
+  http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>jax_rs_big_query</artifactId>
+    <name>JAX-RS Big Query Demo</name>
+    <description>JAX-RS Big Query Demo</description>
+    <packaging>war</packaging>
+    <parent>
+        <groupId>org.apache.cxf.samples</groupId>
+        <artifactId>cxf-samples</artifactId>
+        <version>3.1.0-SNAPSHOT</version>
+        <relativePath>../..</relativePath>
+    </parent>
+    <properties>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>3.1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>3.1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-security-jose</artifactId>
+            <version>3.1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-security-sso-oidc</artifactId>
+            <version>3.1.0-SNAPSHOT</version>
+        </dependency> 
+        <dependency>
+            <groupId>javax.ws.rs</groupId>
+            <artifactId>javax.ws.rs-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>4.1.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>4.1.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>4.1.1.RELEASE</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <!-- Name of the generated WAR file -->
+        <finalName>rest</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.mortbay.jetty</groupId>
+                <artifactId>maven-jetty-plugin</artifactId>
+                <version>6.1.15</version>
+                <configuration>
+                    <contextPath>/${project.build.finalName}</contextPath>
+                    <connectors>
+                      <connector implementation="org.mortbay.jetty.security.SslSocketConnector">
+                         <port>8080</port>
+                         <keystore>${project.build.directory}/rest/WEB-INF/servicestore.jks</keystore>
+                         <password>sspass</password>
+                         <keyPassword>skpass</keyPassword>
+                      </connector>
+                    </connectors>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>2.1.1</version>
+                <configuration>
+                    <webResources>
+                        <resource>
+                            <directory>src/main/webapp</directory>
+                            <filtering>true</filtering>
+                            <includes>
+                                <include>**/applicationContext.xml</include>
+                                <include>**/index.html</include>
+                            </includes>
+                        </resource>
+                    </webResources>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cxf/blob/5bac26a1/distribution/src/main/release/samples/jax_rs/big_query/src/main/java/demo/jaxrs/server/BigQueryService.java
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/big_query/src/main/java/demo/jaxrs/server/BigQueryService.java
b/distribution/src/main/release/samples/jax_rs/big_query/src/main/java/demo/jaxrs/server/BigQueryService.java
new file mode 100644
index 0000000..37840d6
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/big_query/src/main/java/demo/jaxrs/server/BigQueryService.java
@@ -0,0 +1,164 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.jaxrs.server;
+
+import java.net.URI;
+import java.util.Collections;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.rs.security.oauth2.client.Consumer;
+import org.apache.cxf.rs.security.oauth2.client.OAuthClientUtils;
+import org.apache.cxf.rs.security.oauth2.common.AccessTokenGrant;
+import org.apache.cxf.rs.security.oauth2.common.ClientAccessToken;
+import org.apache.cxf.rs.security.oauth2.grants.code.AuthorizationCodeGrant;
+import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
+import org.apache.cxf.rs.security.oidc.common.IdToken;
+import org.apache.cxf.rs.security.oidc.common.UserInfo;
+import org.apache.cxf.rs.security.oidc.rp.IdTokenValidator;
+
+@Path("/service")
+public class BigQueryService {
+
+    @Context
+    private UriInfo uriInfo;
+    @Context
+    private HttpHeaders httpHeaders;
+
+    private String authorizationServiceUri;
+    private WebClient accessTokenServiceClient;
+    private WebClient userInfoServiceClient;
+    private IdTokenValidator tokenValidator;
+    private Consumer consumer;
+
+    @GET
+    @Path("/oidc/rp/start")
+    public Response startUserAuthentication() {
+        URI indexUri = uriInfo.getBaseUriBuilder().path("index.html").build();
+        return Response.seeOther(indexUri).build();
+    }
+
+    @POST
+    @Path("/oidc/rp/complete")
+    @Consumes("application/octet-stream")
+    @Produces("application/xml,application/json,text/html")
+    public Response completeUserAuthentication(String code) {
+        return doCompleteBigQuery(code, null, true);
+    }
+
+    @GET
+    @Path("/bigquery")
+    public Response startBiqQuery() {
+
+        StringBuilder scopes = new StringBuilder();
+        scopes.append("openid email profile");
+        // Add application specific scopes if any
+
+        URI loc = OAuthClientUtils.getAuthorizationURI(authorizationServiceUri,
+                consumer.getKey(), getRedirectUri(), uriInfo.getAbsolutePath()
+                        .toString(), scopes.toString());
+
+        Response r = Response.seeOther(loc).build();
+        return r;
+    }
+
+    @GET
+    @Path("/bigquery/complete")
+    @Produces("application/xml,application/json,text/html")
+    public Response completeBigQuery(@QueryParam("code") String code,
+            @QueryParam("state") String state) {
+        return doCompleteBigQuery(code, state, false);
+    }
+
+    private Response doCompleteBigQuery(String code, String state,
+            boolean postMessage) {
+
+        // Get the access token
+        ClientAccessToken at = getClientAccessToken(consumer, code, postMessage);
+
+        // Expect and validate id_token
+        IdToken idToken = tokenValidator.getIdTokenFromJwt(at,
+                consumer.getKey());
+
+        // Get User Profile if needed
+        UserInfo userInfo = getUserInfo(at, idToken);
+
+        // Complete the request, use 'at' to access some other user's API,
+        // return the response to the user
+        ResponseBuilder rb = Response.ok().type("application/json");
+        Response r = rb.entity(
+                "{\"email\":\"" + userInfo.getProperty("email") + "\"}")
+                .build();
+        return r;
+    }
+
+    public void setAccessTokenServiceClient(WebClient accessTokenServiceClient) {
+        this.accessTokenServiceClient = accessTokenServiceClient;
+    }
+
+    private String getRedirectUri() {
+        return uriInfo.getBaseUriBuilder().path("/service/bigquery/complete")
+                .build().toString();
+    }
+
+    private ClientAccessToken getClientAccessToken(Consumer consumer,
+            String code, boolean postMessage) {
+        AccessTokenGrant grant = new AuthorizationCodeGrant(code);
+        String redirectUri = postMessage ? "postmessage" : getRedirectUri();
+        return OAuthClientUtils.getAccessToken(accessTokenServiceClient,
+                consumer, grant, Collections.singletonMap(
+                        OAuthConstants.REDIRECT_URI, redirectUri), false);
+    }
+
+    private UserInfo getUserInfo(ClientAccessToken at, IdToken idToken) {
+        if (userInfoServiceClient != null) {
+            OAuthClientUtils.setAuthorizationHeader(userInfoServiceClient, at);
+            return userInfoServiceClient.get(UserInfo.class);
+        }
+        return null;
+    }
+
+    public void setUserInfoServiceClient(WebClient userInfoServiceClient) {
+        this.userInfoServiceClient = userInfoServiceClient;
+    }
+
+    public void setIdTokenValidator(IdTokenValidator tokenValidator) {
+        this.tokenValidator = tokenValidator;
+    }
+
+    public void setAuthorizationServiceUri(String authorizationServiceUri) {
+        this.authorizationServiceUri = authorizationServiceUri;
+    }
+
+    public void setConsumer(Consumer consumer) {
+        this.consumer = consumer;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/5bac26a1/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/applicationContext.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/applicationContext.xml
b/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/applicationContext.xml
new file mode 100644
index 0000000..51d829e
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/applicationContext.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright (C) 2011 Talend Inc. - www.talend.com
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xmlns:jaxrs="http://cxf.apache.org/jaxrs"
+      xmlns:jaxrsclient="http://cxf.apache.org/jaxrs-client"
+      xmlns:http="http://cxf.apache.org/transports/http/configuration"
+      xmlns:sec="http://cxf.apache.org/configuration/security"
+      xsi:schemaLocation="
+         http://www.springframework.org/schema/beans 
+         http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+         http://cxf.apache.org/jaxrs
+         http://cxf.apache.org/schemas/jaxrs.xsd
+         http://cxf.apache.org/jaxrs-client
+         http://cxf.apache.org/schemas/jaxrs-client.xsd
+         http://cxf.apache.org/transports/http/configuration
+         http://cxf.apache.org/schemas/configuration/http-conf.xsd
+         http://cxf.apache.org/configuration/security
+         http://cxf.apache.org/schemas/configuration/security.xsd">
+
+     
+     <!-- Restaurant Reservations Application -->
+     <!--
+     <http:conduit name="*.http-conduit">
+        <http:client ConnectionTimeout="3000000" ReceiveTimeout="3000000"/>
+        <http:tlsClientParameters disableCNCheck="true">
+            <sec:keyManagers keyPassword="skpass">
+                   <sec:keyStore type="JKS" password="sspass" 
+	                file="${project.build.directory}/${project.build.finalName}/WEB-INF/servicestore.jks"/>
+	           </sec:keyManagers>
+	        <sec:trustManagers>
+	           <sec:keyStore type="JKS" password="sspass"
+	               file="${project.build.directory}/${project.build.finalName}/WEB-INF/servicestore.jks"/>
+	        </sec:trustManagers>
+        </http:tlsClientParameters>
+     </http:conduit>
+     -->
+
+     <!-- CXF Logging Feature -->
+     <bean id="loggingFeature" class="org.apache.cxf.feature.LoggingFeature"/>
+
+     <!-- WebClient for requesting an OAuth2 Access token --> 
+     
+     <jaxrsclient:client id="atServiceClient" threadSafe="true" 
+        address="https://accounts.google.com/o/oauth2/token"
+        serviceClass="org.apache.cxf.jaxrs.client.WebClient">
+        <jaxrsclient:headers>
+            <entry key="Accept" value="application/json"/>
+        </jaxrsclient:headers>
+        <jaxrsclient:providers>
+           <bean class="org.apache.cxf.jaxrs.provider.FormEncodingProvider">
+               <property name="expectedEncoded" value="true"/>
+           </bean> 
+        </jaxrsclient:providers>
+        <jaxrsclient:features>
+           <ref bean="loggingFeature"/>
+        </jaxrsclient:features>
+     </jaxrsclient:client> 
+     
+     <!-- WebClient for requesting an OIDC UserInfo -->
+     <jaxrsclient:client id="userProfileClient" threadSafe="true" 
+        address="https://www.googleapis.com/plus/v1/people/me/openIdConnect"
+        serviceClass="org.apache.cxf.jaxrs.client.WebClient">
+        <jaxrsclient:headers>
+            <entry key="Accept" value="application/json"/>
+        </jaxrsclient:headers>
+        <jaxrsclient:providers>
+           <bean class="org.apache.cxf.jaxrs.provider.json.JsonMapObjectProvider"/>

+        </jaxrsclient:providers>
+        <jaxrsclient:features>
+           <ref bean="loggingFeature"/>
+        </jaxrsclient:features>
+     </jaxrsclient:client>  
+     
+     <!-- WebClient for requesting an OIDC IDP JWK Set -->
+     <jaxrsclient:client id="jwkSetClient" threadSafe="true" 
+        address="https://www.googleapis.com/oauth2/v2/certs"
+        serviceClass="org.apache.cxf.jaxrs.client.WebClient">
+        <jaxrsclient:headers>
+            <entry key="Accept" value="application/json"/>
+        </jaxrsclient:headers>
+        <jaxrsclient:providers>
+           <bean class="org.apache.cxf.rs.security.jose.jaxrs.JsonWebKeysProvider"/>

+        </jaxrsclient:providers>
+        <jaxrsclient:features>
+           <ref bean="loggingFeature"/>
+        </jaxrsclient:features>
+     </jaxrsclient:client>
+     
+     <bean id="idTokenValidator" class="org.apache.cxf.rs.security.oidc.rp.IdTokenValidator">
+         <property name="jwkSetClient" ref="jwkSetClient"/> 
+         <property name="issuerId" value="accounts.google.com"/>
+     </bean>
+
+     <bean id="consumer" class="org.apache.cxf.rs.security.oauth2.client.Consumer">
+         <property name="key" value="${client_id}"/> 
+         <property name="secret" value="${client_secret}"/>
+     </bean>
+
+     <bean id="bigQueryService" class="demo.jaxrs.server.BigQueryService">
+         <property name="accessTokenServiceClient" ref="atServiceClient"/>
+         <property name="userInfoServiceClient" ref="userProfileClient"/>
+         <property name="idTokenValidator" ref="idTokenValidator"/>
+         <property name="consumer" ref="consumer"/>
+         <property name="authorizationServiceUri" value="https://accounts.google.com/o/oauth2/auth"/>
+     </bean> 
+     
+     <jaxrs:server id="bigQueryServer" address="/">
+        <jaxrs:serviceBeans>
+           <ref bean="bigQueryService"/>
+        </jaxrs:serviceBeans>
+        <jaxrs:features>
+           <ref bean="loggingFeature"/>
+        </jaxrs:features>
+     </jaxrs:server>
+     
+          
+</beans>
+

http://git-wip-us.apache.org/repos/asf/cxf/blob/5bac26a1/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/servicestore.jks
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/servicestore.jks
b/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/servicestore.jks
new file mode 100644
index 0000000..0dfa206
Binary files /dev/null and b/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/servicestore.jks
differ

http://git-wip-us.apache.org/repos/asf/cxf/blob/5bac26a1/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/web.xml
b/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..2d46709
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright (C) 2011 Talend Inc. - www.talend.com
+-->
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
+         http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+    <display-name>Advanced JAX-RS Web Application</display-name>
+    <listener>
+        <listener-class>
+              org.springframework.web.context.ContextLoaderListener
+        </listener-class>
+    </listener>
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+	      WEB-INF/applicationContext.xml
+        </param-value>
+    </context-param>
+    <servlet>
+        <servlet-name>RESTServlet</servlet-name>
+        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+	<load-on-startup>1</load-on-startup>
+        <init-param>
+            <param-name>static-resources-list</param-name>
+            <param-value>
+                 /index.html
+            </param-value>
+        </init-param> 
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>RESTServlet</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+    <session-config>
+        <session-timeout>60</session-timeout>
+    </session-config>
+</web-app>

http://git-wip-us.apache.org/repos/asf/cxf/blob/5bac26a1/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/index.html
----------------------------------------------------------------------
diff --git a/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/index.html
b/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/index.html
new file mode 100644
index 0000000..b783883
--- /dev/null
+++ b/distribution/src/main/release/samples/jax_rs/big_query/src/main/webapp/index.html
@@ -0,0 +1,59 @@
+<html itemscope itemtype="http://schema.org/Article">
+<head>
+  <!-- BEGIN Pre-requisites -->
+  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
+  </script>
+  <script src="https://apis.google.com/js/client:platform.js?onload=start" async defer>
+  </script>
+  <!-- END Pre-requisites -->
+</head>
+<body>
+<div id="signinButton">
+  <span class="g-signin"
+    data-scope="https://www.googleapis.com/auth/plus.login"
+    data-clientid="${client_id}"
+    data-redirecturi="postmessage"
+    data-accesstype="offline"
+    data-cookiepolicy="single_host_origin"
+    data-callback="signInCallback">
+  </span>
+</div>
+<div id="result"></div>
+<script>
+function signInCallback(authResult) {
+  if (authResult['code']) {
+
+    // Hide the sign-in button now that the user is authorized, for example:
+    $('#signinButton').attr('style', 'display: none');
+
+    // Send the code to the server
+    $.ajax({
+      type: 'POST',
+      url: 'service/oidc/rp/complete',
+      contentType: 'application/octet-stream; charset=utf-8',
+      success: function(result) {
+        // Handle or verify the server response if necessary.
+        // Prints the list of people that the user has allowed the app to know
+        // to the console.
+        console.log(result);
+        //if (result['profile'] && result['people']){
+        //  $('#results').html('Hello ' + result['profile']['displayName'] + '. You successfully
made a server side call to people.get and people.list');
+        //} else {
+        //  $('#results').html('Failed to make a server-side call. Check your configuration
and console.');
+        //}
+      },
+      processData: false,
+      data: authResult['code']
+    });
+  } else if (authResult['error']) {
+    // There was an error.
+    // Possible error codes:
+    //   "access_denied" - User denied access to your app
+    //   "immediate_failed" - Could not automatially log in the user
+    // console.log('There was an error: ' + authResult['error']);
+  }
+}
+</script>
+</body>
+</html>
+


Mime
View raw message