com.google.appengine.api.users.User类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(116)

本文整理了Java中com.google.appengine.api.users.User类的一些代码示例,展示了User类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。User类的具体详情如下:
包路径:com.google.appengine.api.users.User
类名称:User

User介绍

暂无

代码示例

代码示例来源:origin: org.vx68k.quercus/quercus

public String getEmail()
{
 return _user.getEmail();
}

代码示例来源:origin: com.google.oauth-client/google-oauth-client-appengine

@Override
 protected String getUserId(HttpServletRequest req) throws ServletException, IOException {
  // Use GAE Standard's users service to fetch the current user of the application.
  return UserServiceFactory.getUserService().getCurrentUser().getUserId();
 }
}

代码示例来源:origin: org.vx68k.quercus/quercus

public GaeUser(String email,
        String authDomain,
        String userId,
        String federatedIdentity)
{
 _user = new User(email, authDomain, userId, federatedIdentity);
}

代码示例来源:origin: GoogleCloudPlatform/appengine-tck

user = oAuthService.getCurrentUser(currentScope);
    lastValidScope = currentScope;
    log.info("Valid scope, user: " + user.getEmail());
  resp.getWriter().print(responseMsg + "Error: Must set method parameter.");
  return;
  resp.getWriter().print(responseMsg);
  return;
resp.getWriter().print(responseMsg);

代码示例来源:origin: PeterKnego/LeanEngine-Server

response.sendRedirect(
      scheme.getErrorUrl(new LeanException(LeanException.Error.OpenIdAuthNotEnabled), errorUrl));
  return;
String loginUrl = UserServiceFactory.getUserService().createLoginURL(redirectUrl, null, openIdProvider, null);
response.sendRedirect(loginUrl);
User currentUser = UserServiceFactory.getUserService().getCurrentUser();
  response.sendRedirect(
      scheme.getErrorUrl(new LeanException(LeanException.Error.OpenIdAuthFailed), errorUrl));
  return;
LeanAccount account = AccountUtils.findAccountByProvider(currentUser.getUserId(),
    currentUser.getFederatedIdentity());
  props.put("email", currentUser.getEmail());
      currentUser.getNickname(),
      currentUser.getUserId(),
      currentUser.getFederatedIdentity(),
      props
  );

代码示例来源:origin: org.pac4j/pac4j-gae

@Override
protected void clientInit() {
  service = UserServiceFactory.getUserService();
  CommonHelper.assertNotNull("service", this.service);
  defaultRedirectActionBuilder(ctx -> {
    final String destinationUrl = computeFinalCallbackUrl(ctx);
    final String loginUrl = authDomain == null ?  service.createLoginURL(destinationUrl)
      : service.createLoginURL(destinationUrl, authDomain);
    return RedirectAction.redirect(loginUrl);
  });
  defaultCredentialsExtractor(ctx -> {
    final GaeUserCredentials credentials = new GaeUserCredentials();
    credentials.setUser(service.getCurrentUser());
    return credentials;
  });
  defaultAuthenticator((credentials, ctx) -> {
    final User user = credentials.getUser();
    if (user != null) {
      final GaeUserServiceProfile profile = PROFILE_DEFINITION.newProfile();
      profile.setId(user.getEmail());
      PROFILE_DEFINITION.convertAndAdd(profile, PROFILE_ATTRIBUTE, CommonProfileDefinition.EMAIL, user.getEmail());
      PROFILE_DEFINITION.convertAndAdd(profile, PROFILE_ATTRIBUTE, CommonProfileDefinition.DISPLAY_NAME, user.getNickname());
      if (service.isUserAdmin()) {
        profile.addRole(GaeUserServiceProfile.PAC4J_GAE_GLOBAL_ADMIN_ROLE);
      }
      credentials.setUserProfile(profile);
    }
  });
}

代码示例来源:origin: com.googlecode.cedar-common/objectify

public static void serialize(SerializationStreamWriter streamWriter, User instance)
      throws SerializationException
  {
    streamWriter.writeString(instance.getEmail());
    streamWriter.writeString(instance.getAuthDomain());
    streamWriter.writeString(instance.getUserId());
  }
}

代码示例来源:origin: org.vx68k.quercus/quercus

public String getUserId()
{
 return _user.getUserId();
}

代码示例来源:origin: org.vx68k.quercus/quercus

public String getNickname()
{
 return _user.getNickname();
}

代码示例来源:origin: org.vx68k.quercus/quercus

public String getFederatedIdentity()
{
 return _user.getFederatedIdentity();
}

代码示例来源:origin: org.vx68k.quercus/quercus

public String getAuthDomain()
{
 return _user.getAuthDomain();
}

代码示例来源:origin: com.google.oauth-client/google-oauth-client-appengine

@Override
 protected String getUserId(HttpServletRequest req) throws ServletException, IOException {
  // Use GAE Standard's users service to fetch the current user of the application.
  return UserServiceFactory.getUserService().getCurrentUser().getUserId();
 }
}

代码示例来源:origin: GoogleCloudPlatform/appengine-tck

private String callMethod(String method, String scope) {
  try {
    if (method.equals("getEmail")) {
      if (errorOnScope != null) {
        return errorOnScope;
      }
      if (user == null) {
        return "user is null";
      } else {
        return user.getEmail();
      }
    } else if (method.equals("isUserAdmin")) {
      if (scope == null) {
        return "" + oAuthService.isUserAdmin();
      } else {
        return "" + oAuthService.isUserAdmin(scope);
      }
    } else if (method.equals("getClientId")) {
      return oAuthService.getClientId(scope);
    } else if (method.equals("getOAuthConsumerKey")) {
      return oAuthService.getOAuthConsumerKey();
    } else if (method.equals("isUserAdmin")) {
      return "" + oAuthService.isUserAdmin();
    } else {
      return "UNRECOGNIZED METHOD:" + method;
    }
  } catch (Exception e) {
    return method + ":" + e.toString();
  }
}

代码示例来源:origin: GoogleCloudPlatform/appengine-tck

@Test
public void testUserProperty() {
  testEqualityQueries(new User("foo@foo.com", "authDomain", "userId", "federatedIdentity"), new User("bar@bar.com", "authDomain", "userId", "federatedIdentity"));
  testInequalityQueries(new User("aaa@foo.com", "authDomain"), new User("bbb@foo.com", "authDomain"), new User("ccc@foo.com", "authDomain"));
}

代码示例来源:origin: com.google.oauth-client/google-oauth-client-extensions

/**
  * Return the user id for the currently logged in user.
  */
 static final String getUserId() {
  UserService userService = UserServiceFactory.getUserService();
  User loggedIn = userService.getCurrentUser();
  Preconditions.checkState(loggedIn != null, "This servlet requires the user to be logged in.");
  return loggedIn.getUserId();
 }
}

代码示例来源:origin: com.googlecode.cedar-common/objectify

public static User instantiate(SerializationStreamReader streamReader)
    throws SerializationException
{
  String email = streamReader.readString();
  String auth = streamReader.readString();
  String userid = streamReader.readString();
  return new User(email, auth, userid);
}

代码示例来源:origin: com.google.oauth-client/google-oauth-client-appengine

/**
  * Return the user id for the currently logged in user.
  */
 static final String getUserId() {
  UserService userService = UserServiceFactory.getUserService();
  User loggedIn = userService.getCurrentUser();
  Preconditions.checkState(loggedIn != null, "This servlet requires the user to be logged in.");
  return loggedIn.getUserId();
 }
}

代码示例来源:origin: GoogleCloudPlatform/appengine-tck

asSet(new GeoPt(10f, 10f)),
asSet(new GeoPt(20f, 20f)),
asSet(new User("aaa", "aaa"), new User("aaa", "otherAuthDomain")),  // ordering must depend only on the email
asSet(new User("bbb", "bbb")),
asSet(KeyFactory.createKey("kind", "aaa")),
asSet(KeyFactory.createKey("kind", "bbb"))

相关文章