Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wso2 n、 sqlStmt,参数)。长度>0){ i存在=真; } 返回是存在的; }捕获(SQLE异常){ log.error(e.getMessage(),e); log.error(“使用sql:+sqlStmt”); 抛出新的UserStoreExcep_Wso2_Wso2is - Fatal编程技术网

Wso2 n、 sqlStmt,参数)。长度>0){ i存在=真; } 返回是存在的; }捕获(SQLE异常){ log.error(e.getMessage(),e); log.error(“使用sql:+sqlStmt”); 抛出新的UserStoreExcep

Wso2 n、 sqlStmt,参数)。长度>0){ i存在=真; } 返回是存在的; }捕获(SQLE异常){ log.error(e.getMessage(),e); log.error(“使用sql:+sqlStmt”); 抛出新的UserStoreExcep,wso2,wso2is,Wso2,Wso2is,n、 sqlStmt,参数)。长度>0){ i存在=真; } 返回是存在的; }捕获(SQLE异常){ log.error(e.getMessage(),e); log.error(“使用sql:+sqlStmt”); 抛出新的UserStoreException(e.getMessage(),e); }最后{ 如果(doClose){ DatabaseUtil.closeAllConnections(dbConnection、rs、Prepsmt); } } } 公共字符串[]getUserL

n、 sqlStmt,参数)。长度>0){ i存在=真; } 返回是存在的; }捕获(SQLE异常){ log.error(e.getMessage(),e); log.error(“使用sql:+sqlStmt”); 抛出新的UserStoreException(e.getMessage(),e); }最后{ 如果(doClose){ DatabaseUtil.closeAllConnections(dbConnection、rs、Prepsmt); } } } 公共字符串[]getUserListFromProperties(字符串属性、字符串值、字符串配置文件名) 抛出UserStoreException{ 返回新字符串[0]; } /*@凌驾 公共地图doGetUserClaimValues(字符串用户名,字符串[]声明, 字符串域名)引发UserStoreException{ 返回新的HashMap(); }*/ /*@凌驾 公共字符串doGetUserClaimValue(字符串用户名、字符串声明、字符串配置文件名) 抛出UserStoreException{ 返回null; }*/ @凌驾 公共布尔值isReadOnly()引发UserStoreException{ 返回true; } @凌驾 public void doAddUser(字符串用户名、对象凭据、字符串[]角色列表、, 映射声明,字符串profileName, 布尔值requirePasswordChange)引发UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } public void doAddRole(字符串roleName,字符串[]userList,org.wso2.carbon.user.api.Permission[]permissions) 抛出UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void dodeletrole(字符串roleName)引发UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void dodeletueser(字符串用户名)引发UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 公共布尔值isBulkImportSupported(){ 返回false; } @凌驾 public void doUpdateRoleName(字符串roleName,字符串newRoleName)引发UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void doUpdateUserListOfRole(字符串roleName,字符串[]deletedUsers,字符串[]newUsers) 抛出UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void doUpdateRoleListOfUser(字符串用户名,字符串[]deletedRoles,字符串[]newRoles) 抛出UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void doSetUserClaimValue(字符串用户名、字符串claimURI、字符串claimValue、, 字符串profileName)引发UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void doSetUserClaimValues(字符串用户名、映射声明、, 字符串profileName)引发UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void doDeleteUserClaimValue(字符串用户名、字符串claimURI、字符串配置文件名) 抛出UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void doDeleteUserClaimValues(字符串用户名、字符串[]声明、字符串配置文件名) 抛出UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void doUpdateCredential(字符串用户名、对象newCredential、对象oldCredential) 抛出UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } @凌驾 public void doUpdateCredentialByAdmin(字符串用户名、对象newCredential) 抛出UserStoreException{ 抛出新的UserStoreException( “用户存储正在以只读模式运行。无法写入用户存储。”); } 公共字符串[]GetExternalRoleListFuser(字符串用户名)引发UserStoreException{ /*informix用户存储管理器应该是只读的,并且是自定义用户存储中的用户 自定义用户存储中的用户仅分配给内部角色。因此,此方法 返回一个空字符串。 */ 返回新字符串[0]; } @凌驾 公共字符串[]doGetRoleNames(字符串筛选器,int maxItemLimit)引发UserStoreException{ 返回新字符串[0]; } @凌驾 公共布尔值doCheckExistingRole(字符串roleName)引发UserStoreException{ 返回false; } @凌驾 公共布尔值doCheckExistingUser(字符串用户名)引发UserStoreException{ 返回true; } @凌驾 public org.wso2.carbon.user.api.Properties getDefaultUserStoreProperties(){ 属性=新属性(); properties.setMandatoryProperties(CustomUserStoreConstants.CUSTOM_UM_MANDATORY_properties.toArray
[2020-02-18 11:03:36,781] [cf46aae7-eb2b-4eeb-9683-e7adbbba5c1f] ERROR {org.wso2.carbon.core.services.authentication.AuthenticationAdmin} - System error while Authenticating/Authorizing User : Error when handling event : PRE_AUTHENTICATION
public class CustomUserStoreConstants { //Properties for Read Active Directory User Store Manager public static final ArrayList<Property> CUSTOM_UM_MANDATORY_PROPERTIES = new ArrayList<Property>(); public static final ArrayList<Property> CUSTOM_UM_OPTIONAL_PROPERTIES = new ArrayList<Property>(); public static final ArrayList<Property> CUSTOM_UM_ADVANCED_PROPERTIES = new ArrayList<Property>(); static { setMandatoryProperty(JDBCRealmConstants.DRIVER_NAME, "Driver Name", "", "Full qualified driver name"); setMandatoryProperty(JDBCRealmConstants.URL,"Connection URL", "", "URL of the user store database"); setMandatoryProperty(JDBCRealmConstants.USER_NAME, "User Name","", "Username for the database"); setMandatoryProperty(JDBCRealmConstants.PASSWORD, "Password","", "Password for the database"); setProperty(UserStoreConfigConstants.disabled,"Disabled", "false", UserStoreConfigConstants.disabledDescription); setProperty("ReadOnly","Read Only", "true", "Indicates whether the user store of this realm operates in the user read only mode or not"); setProperty(UserStoreConfigConstants.SCIMEnabled,"SCIM Enabled", "false", UserStoreConfigConstants.SCIMEnabledDescription); //Advanced Properties (No descriptions added for each property) setAdvancedProperty("SelectUserSQL","Select User SQL", "SELECT * FROM CUSTOMER_DATA WHERE CUSTOMER_NAME=?", ""); setAdvancedProperty("UserFilterSQL","User Filter SQL", "SELECT CUSTOMER_NAME FROM CUSTOMER_DATA WHERE CUSTOMER_NAME LIKE ? ORDER BY CUSTOMER_ID", ""); setAdvancedProperty("ClaimOperationsSupported","Claim Operations Supported","false",""); } private static void setProperty(String name, String displayName, String value, String description) { Property property = new Property(name, value, displayName + "#" +description, null); CUSTOM_UM_OPTIONAL_PROPERTIES.add(property); } private static void setMandatoryProperty(String name, String displayName, String value, String description) { Property property = new Property(name, value, displayName + "#" +description, null); CUSTOM_UM_MANDATORY_PROPERTIES.add(property); } private static void setAdvancedProperty(String name, String displayName, String value, String description) { Property property = new Property(name, value, displayName + "#" +description, null); CUSTOM_UM_ADVANCED_PROPERTIES.add(property); } } public class CustomUserStoreManager extends JDBCUserStoreManager { private static Log log = LogFactory.getLog(CustomUserStoreManager.class); public CustomUserStoreManager() { } public CustomUserStoreManager(org.wso2.carbon.user.api.RealmConfiguration realmConfig, Map<String, Object> properties, ClaimManager claimManager, ProfileConfigurationManager profileManager, UserRealm realm, Integer tenantId) throws UserStoreException { super(realmConfig, properties, claimManager, profileManager, realm, tenantId, false); } @Override public boolean doAuthenticate(String userName, Object credential) throws UserStoreException { System.out.println("TRYING TO LOGIN HERE "); if (CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equals(userName)) { log.error("Anonymous user trying to login"); return false; } Connection dbConnection = null; ResultSet rs = null; PreparedStatement prepStmt = null; String sqlstmt = null; String password = (String) credential; boolean isAuthed = false; try { dbConnection = getDBConnection(); dbConnection.setAutoCommit(false); //paring the SELECT_USER_SQL from user_mgt.xml sqlstmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.SELECT_USER); if (log.isDebugEnabled()) { log.debug(sqlstmt); } prepStmt = dbConnection.prepareStatement(sqlstmt); prepStmt.setString(1, userName); rs = prepStmt.executeQuery(); if (rs.next()) { String storedPassword = rs.getString(2); if ((storedPassword != null) && (storedPassword.trim().equals(password))) { isAuthed = true; } } } catch (SQLException e) { throw new UserStoreException("Authentication Failure. Using sql :" + sqlstmt); } finally { DatabaseUtil.closeAllConnections(dbConnection, rs, prepStmt); } if (log.isDebugEnabled()) { log.debug("User " + userName + " login attempt. Login success :: " + isAuthed); } return isAuthed; } @Override public Date getPasswordExpirationTime(String userName) throws UserStoreException { return null; } protected boolean isValueExisting(String sqlStmt, Connection dbConnection, Object... params) throws UserStoreException { PreparedStatement prepStmt = null; ResultSet rs = null; boolean isExisting = false; boolean doClose = false; try { if (dbConnection == null) { dbConnection = getDBConnection(); doClose = true; //because we created it } if (DatabaseUtil.getStringValuesFromDatabase(dbConnection, sqlStmt, params).length > 0) { isExisting = true; } return isExisting; } catch (SQLException e) { log.error(e.getMessage(), e); log.error("Using sql : " + sqlStmt); throw new UserStoreException(e.getMessage(), e); } finally { if (doClose) { DatabaseUtil.closeAllConnections(dbConnection, rs, prepStmt); } } } public String[] getUserListFromProperties(String property, String value, String profileName) throws UserStoreException { return new String[0]; } /*@Override public Map<String, String> doGetUserClaimValues(String userName, String[] claims, String domainName) throws UserStoreException { return new HashMap<String, String>(); }*/ /*@Override public String doGetUserClaimValue(String userName, String claim, String profileName) throws UserStoreException { return null; }*/ @Override public boolean isReadOnly() throws UserStoreException { return true; } @Override public void doAddUser(String userName, Object credential, String[] roleList, Map<String, String> claims, String profileName, boolean requirePasswordChange) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } public void doAddRole(String roleName, String[] userList, org.wso2.carbon.user.api.Permission[] permissions) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doDeleteRole(String roleName) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doDeleteUser(String userName) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public boolean isBulkImportSupported() { return false; } @Override public void doUpdateRoleName(String roleName, String newRoleName) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doUpdateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doUpdateRoleListOfUser(String userName, String[] deletedRoles, String[] newRoles) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doSetUserClaimValue(String userName, String claimURI, String claimValue, String profileName) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doSetUserClaimValues(String userName, Map<String, String> claims, String profileName) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doDeleteUserClaimValue(String userName, String claimURI, String profileName) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doDeleteUserClaimValues(String userName, String[] claims, String profileName) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doUpdateCredential(String userName, Object newCredential, Object oldCredential) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } @Override public void doUpdateCredentialByAdmin(String userName, Object newCredential) throws UserStoreException { throw new UserStoreException( "User store is operating in read only mode. Cannot write into the user store."); } public String[] getExternalRoleListOfUser(String userName) throws UserStoreException { /*informix user store manager is supposed to be read only and users in the custom user store users in the custom user store are only assigned to internal roles. Therefore this method returns an empty string. */ return new String[0]; } @Override public String[] doGetRoleNames(String filter, int maxItemLimit) throws UserStoreException { return new String[0]; } @Override public boolean doCheckExistingRole(String roleName) throws UserStoreException { return false; } @Override public boolean doCheckExistingUser(String userName) throws UserStoreException { return true; } @Override public org.wso2.carbon.user.api.Properties getDefaultUserStoreProperties(){ Properties properties = new Properties(); properties.setMandatoryProperties(CustomUserStoreConstants.CUSTOM_UM_MANDATORY_PROPERTIES.toArray (new Property[CustomUserStoreConstants.CUSTOM_UM_MANDATORY_PROPERTIES.size()])); properties.setOptionalProperties(CustomUserStoreConstants.CUSTOM_UM_OPTIONAL_PROPERTIES.toArray (new Property[CustomUserStoreConstants.CUSTOM_UM_OPTIONAL_PROPERTIES.size()])); properties.setAdvancedProperties(CustomUserStoreConstants.CUSTOM_UM_ADVANCED_PROPERTIES.toArray (new Property[CustomUserStoreConstants.CUSTOM_UM_ADVANCED_PROPERTIES.size()])); return properties; } } @Component( name = "com.wso2.carbon.custom.user.store.manager", immediate = true ) public class CustomUserStoreMgtDSComponent { private static Log log = LogFactory.getLog(CustomUserStoreMgtDSComponent.class); private static RealmService realmService; @Activate protected void activate(ComponentContext ctxt) { try { CustomUserStoreManager customUserStoreManager = new CustomUserStoreManager(); ctxt.getBundleContext().registerService(UserStoreManager.class.getName(), customUserStoreManager, null); log.info("CustomUserStoreManager bundle activated successfully.."); } catch (Throwable storeError) { log.error("ERROR when activating Custom User Store", storeError); } } @Deactivate protected void deactivate(ComponentContext ctxt) { System.out.println(" !!! DEACTIVATE COMP !!!"); if (log.isDebugEnabled()) { log.debug("Custom User Store Manager is deactivated "); } } @Reference( name = "RealmService", service = org.wso2.carbon.user.core.service.RealmService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { realmService = realmService; } protected void unsetRealmService(RealmService realmService) { realmService = null; } }