• <i id='w7gVq'><tr id='w7gVq'><dt id='w7gVq'><q id='w7gVq'><span id='w7gVq'><b id='w7gVq'><form id='w7gVq'><ins id='w7gVq'></ins><ul id='w7gVq'></ul><sub id='w7gVq'></sub></form><legend id='w7gVq'></legend><bdo id='w7gVq'><pre id='w7gVq'><center id='w7gVq'></center></pre></bdo></b><th id='w7gVq'></th></span></q></dt></tr></i><div id='w7gVq'><tfoot id='w7gVq'></tfoot><dl id='w7gVq'><fieldset id='w7gVq'></fieldset></dl></div>
  • <tfoot id='w7gVq'></tfoot>
  • <legend id='w7gVq'><style id='w7gVq'><dir id='w7gVq'><q id='w7gVq'></q></dir></style></legend>

      <bdo id='w7gVq'></bdo><ul id='w7gVq'></ul>

  • <small id='w7gVq'></small><noframes id='w7gVq'>

      1. WSO2 身份服务器 AuthenticationAdmin API 身份验证失败

        WSO2 Identity Server AuthenticationAdmin API Authentication Failed(WSO2 身份服务器 AuthenticationAdmin API 身份验证失败)
        <i id='sl5YZ'><tr id='sl5YZ'><dt id='sl5YZ'><q id='sl5YZ'><span id='sl5YZ'><b id='sl5YZ'><form id='sl5YZ'><ins id='sl5YZ'></ins><ul id='sl5YZ'></ul><sub id='sl5YZ'></sub></form><legend id='sl5YZ'></legend><bdo id='sl5YZ'><pre id='sl5YZ'><center id='sl5YZ'></center></pre></bdo></b><th id='sl5YZ'></th></span></q></dt></tr></i><div id='sl5YZ'><tfoot id='sl5YZ'></tfoot><dl id='sl5YZ'><fieldset id='sl5YZ'></fieldset></dl></div>
          1. <small id='sl5YZ'></small><noframes id='sl5YZ'>

          2. <tfoot id='sl5YZ'></tfoot>
              • <bdo id='sl5YZ'></bdo><ul id='sl5YZ'></ul>
                  <tbody id='sl5YZ'></tbody>

                <legend id='sl5YZ'><style id='sl5YZ'><dir id='sl5YZ'><q id='sl5YZ'></q></dir></style></legend>

                  本文介绍了WSO2 身份服务器 AuthenticationAdmin API 身份验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在关注这里提到的教程:https://docs.wso2.com/display/IS500/管理+用户+and+角色+with+API

                  I am following tutorial mentioned here: https://docs.wso2.com/display/IS500/Managing+Users+and+Roles+with+APIs

                  并使用页面上提供的示例代码:http://cache.facilelogin.com/org.wso2.identity.um.sample.zip

                  And using the sample code provided on the page: http://cache.facilelogin.com/org.wso2.identity.um.sample.zip

                  我已将所需的 JAR 添加到 eclipse 项目中.该项目成功构建,没有任何问题.但是,当我运行该项目时,出现以下错误:

                  I have added the required JARs to the eclipse project. The project builds successfully without any issues. However, when i run the project, i get following errors:

                  log4j:WARN 找不到记录器 (org.apache.axiom.om.util.StAXUtils) 的附加程序.log4j:WARN 请正确初始化 log4j 系统.org.apache.axis2.AxisFault:身份验证失败:传递的远程地址无效 - myapp在 org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:508)在 org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)在 org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)在 org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)在 org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)在 org.wso2.carbon.authenticator.proxy.AuthenticationAdminStub.login(AuthenticationAdminStub.java:311)在 org.wso2.identity.um.sample.IdentityServerClient.main(IdentityServerClient.java:67)

                  log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAXUtils). log4j:WARN Please initialize the log4j system properly. org.apache.axis2.AxisFault: Authentication Failed : Invalid remote address passed - myapp at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:508) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375) 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.authenticator.proxy.AuthenticationAdminStub.login(AuthenticationAdminStub.java:311) at org.wso2.identity.um.sample.IdentityServerClient.main(IdentityServerClient.java:67)

                  这是代码:

                   package org.wso2.identity.um.sample;
                  
                   import java.util.HashMap;
                   import java.util.Map;
                  
                   import org.apache.axis2.context.ConfigurationContext;
                   import org.apache.axis2.context.ConfigurationContextFactory;
                   import org.apache.axis2.transport.http.HTTPConstants;
                   import org.wso2.carbon.authenticator.proxy.AuthenticationAdminStub;
                   import org.wso2.carbon.um.ws.api.WSRealmBuilder;
                   import org.wso2.carbon.user.core.UserRealm;
                   import org.wso2.carbon.user.core.UserStoreManager;
                  
                   public class IdentityServerClient {
                  
                      // ONE TIME TASKS WE NEED TO DO BEFORE EXECUTING THIS PROGRAM.
                  
                      // TASK - 1 , CREATE a LoginOnly role from IS UI Console
                      // ===========================================================
                      // 0. Login as admin/admin
                      // 1. Go to Users and Roles
                      // 2. Click on Roles
                      // 3. Add New Role
                      // 4. Role Name : loginOnly [please use this name, since it's referred within the code below]
                      // 5. Click Next
                      // 6. Select only the 'Login' permission
                      // 7. Click Next
                      // 8. No need to select any users
                      // 9. Click Finish
                  
                      // TASK - 2 , CREATE a custom claim IS UI Console
                      // ===========================================================
                      // 0. Login as admin/admin
                      // 1. Go to Claim Management
                      // 2. Click on http://wso2.org/claims
                      // 3. Click on 'Add New Claim Mapping'
                      // 3.1 Display Name : Business Phone
                      // 3.2 Description : Business Phone
                      // 3.3 Claim Uri : http://wso2.org/claims/businessphone
                      // 3.4 Mapped Attribute : http://wso2.org/claims/businessphone
                      // 3.5 Support by default : Checked
                      // 3.6 The rest can be kept blank
                  
                      private final static String SERVER_URL = "https://localhost:9443/services/";
                      private final static String APP_ID = "myapp";
                  
                      /**
                       * @param args
                       */
                      public static void main(String[] args) {
                  
                          AuthenticationAdminStub authstub = null;
                          ConfigurationContext configContext = null;
                          String cookie = null;
                          String newUser = "prabath2";
                  
                          System.setProperty("javax.net.ssl.trustStore", "wso2carbon.jks");
                          System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
                  
                          try {
                              configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                                      "repo", "repo/conf/client.axis2.xml");
                              authstub = new AuthenticationAdminStub(configContext, SERVER_URL
                                      + "AuthenticationAdmin");
                  
                              // Authenticates as a user having rights to add users.
                              if (authstub.login("admin", "admin", APP_ID)) {
                                  cookie = (String) authstub._getServiceClient().getServiceContext().getProperty(
                                          HTTPConstants.COOKIE_STRING);
                  
                                  UserRealm realm = WSRealmBuilder.createWSRealm(SERVER_URL, cookie, configContext);
                                  UserStoreManager storeManager = realm.getUserStoreManager();
                  
                                  // Add a new role - with no users - with APP_ID as the role name
                  
                                  if (!storeManager.isExistingRole(APP_ID)) {
                  
                                      storeManager.addRole(APP_ID, null, null);
                                      System.out.println("The role added successfully to the system");
                                  } else {
                                      System.out.println("The role trying to add - alraedy there in the system");
                                  }
                  
                                  if (!storeManager.isExistingUser(newUser)) {
                                      // Let's the this user to APP_ID role we just created.
                  
                                      // First let's create claims for users.
                                      // If you are using a claim that does not exist in default IS instance,
                                      Map<String, String> claims = new HashMap<String, String>();
                  
                                      // TASK-1 and TASK-2 should be completed by now.
                                      // Here I am using an already existing claim
                                      claims.put("http://wso2.org/claims/businessphone", "0112842302");
                  
                                      // Here we pass null for the profile - so it will use the default profile.
                                      storeManager.addUser(newUser, "password", new String[] { APP_ID, "loginOnly" },
                                              claims, null);
                                      System.out.println("The use added successfully to the system");
                                  } else {
                                      System.out.println("The user trying to add - alraedy there in the system");
                                  }
                  
                                  // Now let's see the given user [newUser] belongs to the role APP_ID.
                                  String[] userRoles = storeManager.getRoleListOfUser(newUser);
                                  boolean found = false;
                  
                                  if (userRoles != null) {
                                      for (int i = 0; i < userRoles.length; i++) {
                                          if (APP_ID.equals(userRoles[i])) {
                                              found = true;
                                              System.out.println("The user is in the required role");
                                              break;
                                          }
                                      }
                                  }
                  
                                  if (!found){
                                      System.out.println("The user is NOT in the required role");
                                  }
                              }
                          } catch (Exception e) {
                              e.printStackTrace();
                          }
                      }
                   }
                  

                  我已经设置好了

                  <HideAdminServiceWSDLs> 
                  

                  元素到/repository/conf/carbon.xml 文件中的 false.

                  element to false in /repository/conf/carbon.xml file.

                  以下 Web 服务 URL 在 Web 浏览器中打开,没有任何问题:

                  The following web service URL opens in the web browser without any issues:

                  https://localhost:9443/services/AuthenticationAdmin?wsdl
                  

                  请提出建议.

                  推荐答案

                  尝试将运行客户端的 IP 地址或主机名作为 login() 方法调用的第三个参数传递

                  Try passing your IP address or host name on which the client runs as the 3rd parameter of the login() method call

                  例如

                  authstub.login("admin", "admin", "localhost")
                  

                  这篇关于WSO2 身份服务器 AuthenticationAdmin API 身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Slf4j LoggerFactory.getLogger and sonarqube(Slf4j LoggerFactory.getLogger 和 sonarqube)
                  Security - Array is stored directly(安全性 - 数组直接存储)
                  SonarQube quot;Class Not Foundquot; during Main AST Scan(SonarQube“找不到类在主 AST 扫描期间)
                  Integrate Spock#39;s test with Sonar(将 Spock 的测试与声纳集成)
                  How do I make Hudson/Jenkins fail if Sonar thresholds are breached?(如果违反声纳阈值,我如何让 Hudson/Jenkins 失败?)
                  automatically add curly brackets to all if/else/for/while etc. in a java code-base(自动将大括号添加到 java 代码库中的所有 if/else/for/while 等)

                        <tbody id='Yebuh'></tbody>

                        <tfoot id='Yebuh'></tfoot>
                        <i id='Yebuh'><tr id='Yebuh'><dt id='Yebuh'><q id='Yebuh'><span id='Yebuh'><b id='Yebuh'><form id='Yebuh'><ins id='Yebuh'></ins><ul id='Yebuh'></ul><sub id='Yebuh'></sub></form><legend id='Yebuh'></legend><bdo id='Yebuh'><pre id='Yebuh'><center id='Yebuh'></center></pre></bdo></b><th id='Yebuh'></th></span></q></dt></tr></i><div id='Yebuh'><tfoot id='Yebuh'></tfoot><dl id='Yebuh'><fieldset id='Yebuh'></fieldset></dl></div>
                          <bdo id='Yebuh'></bdo><ul id='Yebuh'></ul>
                        • <small id='Yebuh'></small><noframes id='Yebuh'>

                        • <legend id='Yebuh'><style id='Yebuh'><dir id='Yebuh'><q id='Yebuh'></q></dir></style></legend>