Commit 30f1a61f authored by 0Tyler's avatar 0Tyler

add UserProxyService to get username

parent 8ac11886
......@@ -14,6 +14,7 @@
package com.google.webauthn.gaedemo.servlets;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.google.common.base.Splitter;
......@@ -21,6 +22,7 @@ import com.google.common.collect.Iterables;
import com.google.gson.JsonObject;
import com.google.webauthn.gaedemo.objects.AuthenticationExtensionsClientInputs;
import com.google.webauthn.gaedemo.objects.PublicKeyCredentialRequestOptions;
import com.google.webauthn.gaedemo.service.UserProxyService;
import com.google.webauthn.gaedemo.storage.SessionData;
import java.io.IOException;
import javax.servlet.ServletException;
......@@ -47,7 +49,14 @@ public class BeginGetAssertion extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
/* Tyler start -----------------*/
UserProxyService userProxyService = UserProxyService.getInstance();
User user = userProxyService.getCurrentUser();
String currentUser = (user != null) ? user.getEmail() : userService.getCurrentUser().getEmail();
/* Tyler end -----------------*/
/* Original code
String currentUser = userService.getCurrentUser().getEmail();
*/
String rpId = Iterables.get(Splitter.on(':').split(request.getHeader("Host")), 0);
// String rpId = (request.isSecure() ? "https://" : "http://") + request.getHeader("Host");
PublicKeyCredentialRequestOptions assertion = new PublicKeyCredentialRequestOptions(rpId);
......
......@@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.DatatypeConverter;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.google.common.io.BaseEncoding;
......@@ -35,6 +36,7 @@ import com.google.webauthn.gaedemo.objects.AuthenticatorAssertionResponse;
import com.google.webauthn.gaedemo.objects.PublicKeyCredential;
import com.google.webauthn.gaedemo.server.PublicKeyCredentialResponse;
import com.google.webauthn.gaedemo.server.Server;
import com.google.webauthn.gaedemo.service.UserProxyService;
import com.google.webauthn.gaedemo.storage.Credential;
......@@ -58,7 +60,14 @@ public class FinishGetAssertion extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
/* Tyler start -----------------*/
UserProxyService userProxyService = UserProxyService.getInstance();
User user = userProxyService.getCurrentUser();
String currentUser = (user != null) ? user.getEmail() : userService.getCurrentUser().getEmail();
/* Tyler end -----------------*/
/* Original code
String currentUser = userService.getCurrentUser().getEmail();
*/
String data = request.getParameter("data");
if (data == null) {
data = "";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment