在 WSO2 IS 5.9.0 中更改用户名的正则表达式限制后,Token Introspect API 不工作?
Token Introspect API not working after changing the regex restriction for username in WSO2 IS 5.9.0?
我正在使用 WSO2 身份服务器并使用以下文档中的电子邮件作为用户名-
https://is.docs.wso2.com/en/5.9.0/learn/using-email-address-as-the-username/
然后在执行注册时,即使用 SCIM2 APIs 创建用户,电子邮件超过 30 个字符,我收到以下错误 -
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:Error"
],
"scimType": "invalidValue",
"detail": "31301 - Username test1233.admin@motioneducation.com is not valid. User name must be a non null string with following format, ^[\S]{3,30}$",
"status": "400"
}
然后为了解决这个问题,我在用户存储的 deployment.toml 文件中添加了这个正则表达式-
[user_store]
username_java_script_regex = '^[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$'
username_java_regex='^[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}'
此更改解决了我的注册问题,但是使用 wso2 /oauth2/token API 执行登录生成的令牌在 /oauth2/introspect API 中给出了 401 未授权?
请帮忙..........?
既然您启用了电子邮件作为用户名,那么您还需要在授权header中使用电子邮件用户名。下面给出了示例 curl 命令。
curl --location --request POST
'https://{host_name}:{port}/oauth2/introspect'
--header 'Content-Type: application/x-www-form-urlencoded'
--header 'Authorization: Basic {base64encode(emailusername:password)}'
--data-urlencode 'token={access_token}'
样品申请
curl --location --request POST
'https://localhost:9443/oauth2/introspect'
--header 'Content-Type: application/x-www-form-urlencoded'
--header 'Authorization: Basic YWRtaW5Ad3NvMi5jb206YWRtaW4='
--data-urlencode 'token=47f65812-c5fb-3f90-b5c0-3bbc3603578f'
401 未经授权的错误仅在您发送无效凭据时出现。因此,请检查您是否在授权 header
中发送有效的 电子邮件用户名和有效密码
我正在使用 WSO2 身份服务器并使用以下文档中的电子邮件作为用户名- https://is.docs.wso2.com/en/5.9.0/learn/using-email-address-as-the-username/
然后在执行注册时,即使用 SCIM2 APIs 创建用户,电子邮件超过 30 个字符,我收到以下错误 -
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:Error"
],
"scimType": "invalidValue",
"detail": "31301 - Username test1233.admin@motioneducation.com is not valid. User name must be a non null string with following format, ^[\S]{3,30}$",
"status": "400"
}
然后为了解决这个问题,我在用户存储的 deployment.toml 文件中添加了这个正则表达式-
[user_store]
username_java_script_regex = '^[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$'
username_java_regex='^[a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}'
此更改解决了我的注册问题,但是使用 wso2 /oauth2/token API 执行登录生成的令牌在 /oauth2/introspect API 中给出了 401 未授权?
请帮忙..........?
既然您启用了电子邮件作为用户名,那么您还需要在授权header中使用电子邮件用户名。下面给出了示例 curl 命令。
curl --location --request POST 'https://{host_name}:{port}/oauth2/introspect' --header 'Content-Type: application/x-www-form-urlencoded' --header 'Authorization: Basic {base64encode(emailusername:password)}' --data-urlencode 'token={access_token}'
样品申请
curl --location --request POST 'https://localhost:9443/oauth2/introspect' --header 'Content-Type: application/x-www-form-urlencoded' --header 'Authorization: Basic YWRtaW5Ad3NvMi5jb206YWRtaW4=' --data-urlencode 'token=47f65812-c5fb-3f90-b5c0-3bbc3603578f'
401 未经授权的错误仅在您发送无效凭据时出现。因此,请检查您是否在授权 header
中发送有效的 电子邮件用户名和有效密码