【发布时间】:2016-11-21 10:48:46
【问题描述】:
这与WSO2 identity server email as username 的问题完全相同,但我们希望同时提供用户名作为电子邮件地址或用户名(不带@ 的伪)。
我了解使用 @ 的租户完全限定名称的问题,但我们不能更改租户完全限定的 @ 字符吗?
是否可以同时使用电子邮件地址或用户名作为用户名,如果可以,您可以提供配置,我无法按照https://docs.wso2.com/display/IS520/Using+Email+Address+as+the+Username 使其工作
我编辑了我的问题以测试 Rajjaz Mohammed 和 Pradeepa Wickramasinghe 的答案:
我评论了<Property name="UsernameJavascriptRegEx">
当我添加没有 @ 的用户时,我得到:
Caused by: org.wso2.carbon.user.core.UserStoreException: Username jacques.martin is not valid. User name must be a non null string with following format, ^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$
at org.wso2.carbon.user.core.common.AbstractUserStoreManager.addUser(AbstractUserStoreManager.java:1405)
如果我删除这个标签 <Property name="UsernameJavaRegEx"> 我会收到以下错误:
TID: [1] [] [2016-11-22 13:16:50,409] admin@test.com@mytenant.com [1] [IS]ERROR {org.wso2.carbon.identity.mgt.util.Utils} - Unable to retrieve the claim for user : jacques.martin@mytenant.com
org.wso2.carbon.user.core.UserStoreException: UserNotFound: User jacques.martin@mytenant.comdoes not exist in: PRIMARY
at org.wso2.carbon.user.core.common.AbstractUserStoreManager.callSecure(AbstractUserStoreManager.java:168)
at org.wso2.carbon.user.core.common.AbstractUserStoreManager.getUserClaimValues(AbstractUserStoreManager.java:697)
at org.wso2.carbon.identity.mgt.util.Utils.getClaimFromUserStoreManager(Utils.java:189)
at org.wso2.carbon.identity.mgt.util.Utils.getEmailAddressForUser(Utils.java:226)
at org.wso2.carbon.identity.mgt.mail.AbstractEmailSendingModule.getNotificationAddress(AbstractEmailSendingModule.java:53)
at org.wso2.carbon.identity.mgt.RecoveryProcessor.notifyWithEmail(RecoveryProcessor.java:541)
at org.wso2.carbon.identity.mgt.services.UserInformationRecoveryService.registerUser(UserInformationRecoveryService.java:890)
与 Pradeepa Wickramasinghe 的回答相同的错误。
我的java代码如下:
userInformationRecoveryClient.registerUser(user.getUsername(), user.getPassword(), claims, "default", tenant );
在声明中我正确设置了http://wwso2.org/claims/email
【问题讨论】: