【问题标题】:Creating Tenant in FusionAuth with java使用 java 在 FusionAuth 中创建租户
【发布时间】:2021-02-22 13:54:14
【问题描述】:

如何编写代码来使用 fusionAuthClient 创建新租户? 这样我就可以使用 API 调用创建新租户。

Tenant  createTenant = new Tenant()
TenantRequest request = new TenantRequest(tenant);
        ClientResponse<TenantResponse, Errors> response = fusionAuthClient.createTenant(null, request);

我应该在 Tenant() 中写什么,我有 .with() 并尝试配置它,但它一直抛出 NullPointerException。 空指针异常开启 .with(tenant -&gt; tenant.externalIdentifierConfiguration.changePasswordIdGenerator.type = SecureGeneratorType.randomBytes)

并且必需参数上有 12 个 NullPointerException。 我试图从我在 FusionAuth 中创建的其他租户复制配置参数。

【问题讨论】:

    标签: java spring spring-boot fusionauth


    【解决方案1】:

    我总是将 API 文档与客户端库结合使用。

    https://fusionauth.io/docs/v1/tech/apis/tenants/#create-a-tenant

    表示需要一些属性。

    您可能更容易通过检索租户、调整值并创建新租户来复制现有租户。

    【讨论】:

    • 我尝试使用所有必需的属性创建它,但由于某种原因,tenant.externalIdentifierConfiguration.changePasswordIdGenerator.type = SecureGeneratorType.randomBytes) 抛出了 NullPointerException。但是我可以通过检索另一个租户并调整一些价值来创建一个新的,谢谢你:)
    • 我找到了 NullPointerException 的解决方案。我创建了ExternalIdentifierConfiguration externalIdentifierConfiguration = new ExternalIdentifierConfiguration(); ,只是做了externalIdentifierConfiguration.changePasswordIdGenerator = new SecureGeneratorConfiguration(32, SecureGeneratorType.randomBytes);,它没有抛出任何nullPointerExceptions。创建了所需的单独配置并将它们设置在新租户中并且它工作
    猜你喜欢
    • 2020-08-15
    • 2021-12-07
    • 1970-01-01
    • 2014-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多