com.stormpath.sdk.application.Application.createAccount()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(87)

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

Application.createAccount介绍

[英]Creates a new Account that may login to this application.

This is mostly a convenience method; it delegates creation to the Application's designated #getDefaultAccountStore(), and functions as follows:

  • If the defaultAccountStore is a Directory: the account is created in the Directory and returned.
  • If the defaultAccountStore is a Group: the account is created in the Group's Directory, assigned to the Group, and then returned.
    [中]创建可以登录到此应用程序的新帐户。
    这主要是一种方便的方法;它将创建委托给应用程序指定的#getDefaultAccountStore(),函数如下:
    *如果defaultAccountStore是一个目录:将在该目录中创建并返回该帐户。
    *如果defaultAccountStore是一个组:在该组的目录中创建该帐户,分配给该组,然后返回。

代码示例

代码示例来源:origin: dogeared/OZorkAuth

@RequestMapping(value = "/v1/r", method = RequestMethod.POST)
public CommandResponse register(@RequestBody Registration registration) {
  if (
    registration == null ||
    Strings.isNullOrEmpty(registration.getGivenName()) || Strings.isNullOrEmpty(registration.getSurName()) ||
    Strings.isNullOrEmpty(registration.getEmail()) || Strings.isNullOrEmpty(registration.getPassword())
  ) {
    throw new RegistrationException("givenName, surName, email and password are all required to register.");
  }
  Account account = client.instantiate(Account.class);
  account
    .setEmail(registration.getEmail())
    .setPassword(registration.getPassword())
    .setGivenName(registration.getGivenName())
    .setSurname(registration.getSurName());
  account = application.createAccount(account);
  CommandResponse res = new CommandResponse();
  res.setStatus("SUCCESS");
  String[] response = {
    "Thank you for registering!",
    account.getGivenName() + " " + account.getSurname(),
    account.getEmail()
  };
  res.setResponse(response);
  return res;
}

代码示例来源:origin: stormpath/stormpath-sdk-java

account = application.createAccount(account);

代码示例来源:origin: stormpath/stormpath-sdk-java

account = app.createAccount(account);
} else {
  final Account[] accountHolder = new Account[]{account};

代码示例来源:origin: com.stormpath.sdk/stormpath-sdk-servlet

account = app.createAccount(account);
} else {
  final Account[] accountHolder = new Account[]{account};

相关文章