gpt4 book ai didi

java - 当前使用 WSO2 Identity Server API 的示例

转载 作者:行者123 更新时间:2023-11-30 04:29:36 26 4
gpt4 key购买 nike

我尝试通过 WSO2 IS API 添加新用户,但最近的使用示例是:
WSO2 Identity Server managing users and roles through API

它可以工作,但是当我尝试执行添加新用户的方法时,它会中断。

还有更多实际例子吗?

这是我的方法:

public void addUser()  throws Exception{
String serviceEndPoint;
UserAdminStub adminStub;

serviceEndPoint = serverUrl + "UserAdmin";
adminStub = new UserAdminStub(configContext, serviceEndPoint);
ServiceClient client = adminStub._getServiceClient();
Options option = client.getOptions();
option.setManageSession(true);
option.setProperty(HTTPConstants.COOKIE_STRING, authCookie);

Map<String, String> claims = new HashMap<String, String>();
ClaimValue[] claimValues = new ClaimValue[2];
ClaimValue claimValue1 = new ClaimValue();
claimValue1.setClaimURI("http://wso2.org/claims/givenname");
claimValue1.setValue("John");
claimValues[0] = claimValue1;

adminStub.addUser("sso", "sso123", null, claimValues, "default");
}

有堆栈跟踪:

org.apache.axis2.AxisFault: unknown
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.RobustOutOnlyAxisOperation$RobustOutOnlyOperationClient.handleResponse(RobustOutOnlyAxisOperation.java:91)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.wso2.carbon.user.mgt.stub.UserAdminStub.addUser(UserAdminStub.java:1298)
at org.wso2.carbon.user.mgt.sample.UserAdminClient.addUser(UserAdminClient.java:125)
at org.wso2.carbon.user.mgt.sample.SampleUserRoleMgtClient.main(SampleUserRoleMgtClient.java:111)

并且有来自 IS 服务器的日志:

java.lang.NullPointerException
at org.wso2.carbon.user.mgt.UserRealmProxy.addUser(UserRealmProxy.java:255)
at org.wso2.carbon.user.mgt.UserAdmin.addUser(UserAdmin.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

最佳答案

所以,我在 IS 源代码中找到了最新的示例,尝试了一下,它有效 =)

http://svn.wso2.org/repos/wso2/carbon/platform/tags/4.0.5/products/is/4.0.0/modules/samples/

关于java - 当前使用 WSO2 Identity Server API 的示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14981584/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com