private static boolean isUsernameEncryptionEnabled() throws CarbonException, UserStoreException { return Boolean.parseBoolean(AdminServicesUtil.getUserRealm().getRealmConfiguration() .getRealmProperties().get(ENCRYPT_USERNAME_IN_URL)); } }
private static boolean isUsernameEncryptionEnabled() throws CarbonException, UserStoreException { return Boolean.parseBoolean(AdminServicesUtil.getUserRealm().getRealmConfiguration() .getRealmProperties().get(ENCRYPT_USERNAME_IN_URL)); } /**
private static boolean isUsernameEncryptionEnabled() throws CarbonException, UserStoreException { return Boolean.parseBoolean(AdminServicesUtil.getUserRealm().getRealmConfiguration() .getRealmProperties().get(ENCRYPT_USERNAME_IN_URL)); } }
private boolean isUserNameWithAllowedDomainName(String userName, UserRealm realm) throws IdentityException { int index; index = userName.indexOf("/"); // Check whether we have a secondary UserStoreManager setup. if (index > 0) { // Using the short-circuit. User name comes with the domain name. try { return !realm.getRealmConfiguration().isRestrictedDomainForSlefSignUp( userName.substring(0, index)); } catch (UserStoreException e) { throw IdentityException.error(e.getMessage(), e); } } return true; }
private void handleFederatedUserNameEqualsToSuperAdminUserName(UserRealm realm, String username, UserStoreManager userStoreManager, Collection<String> deletingRoles) throws UserStoreException, FrameworkException { if (userStoreManager.getRealmConfiguration().isPrimary() && username.equals(realm.getRealmConfiguration().getAdminUserName())) { if (log.isDebugEnabled()) { log.debug("Federated user's username is equal to super admin's username of local IdP."); } // Whether superadmin login without superadmin role is permitted if (deletingRoles .contains(realm.getRealmConfiguration().getAdminRoleName())) { if (log.isDebugEnabled()) { log.debug("Federated user doesn't have super admin role. Unable to sync roles, since" + " super admin role cannot be unassigned from super admin user"); } throw new FrameworkException( "Federated user which having same username to super admin username of local IdP," + " trying login without having super admin role assigned"); } } }
private void handleFederatedUserNameEqualsToSuperAdminUserName(UserRealm realm, String username, UserStoreManager userStoreManager, Collection<String> deletingRoles) throws UserStoreException, FrameworkException { if (userStoreManager.getRealmConfiguration().isPrimary() && username.equals(realm.getRealmConfiguration().getAdminUserName())) { if (log.isDebugEnabled()) { log.debug("Federated user's username is equal to super admin's username of local IdP."); } // Whether superadmin login without superadmin role is permitted if (deletingRoles .contains(realm.getRealmConfiguration().getAdminRoleName())) { if (log.isDebugEnabled()) { log.debug("Federated user doesn't have super admin role. Unable to sync roles, since" + " super admin role cannot be unassigned from super admin user"); } throw new FrameworkException( "Federated user which having same username to super admin username of local IdP," + " trying login without having super admin role assigned"); } } }
private boolean isUserNameWithAllowedDomainName(String userName, UserRealm realm) throws IdentityException { int index; index = userName.indexOf("/"); // Check whether we have a secondary UserStoreManager setup. if (index > 0) { // Using the short-circuit. User name comes with the domain name. try { return !realm.getRealmConfiguration().isRestrictedDomainForSlefSignUp( userName.substring(0, index)); } catch (UserStoreException e) { throw IdentityException.error(e.getMessage(), e); } } return true; }
private void handleFederatedUserNameEqualsToSuperAdminUserName(UserRealm realm, String username, UserStoreManager userStoreManager, Collection<String> deletingRoles) throws UserStoreException, FrameworkException { if (userStoreManager.getRealmConfiguration().isPrimary() && username.equals(realm.getRealmConfiguration().getAdminUserName())) { if (log.isDebugEnabled()) { log.debug("Federated user's username is equal to super admin's username of local IdP."); } // Whether superadmin login without superadmin role is permitted if (deletingRoles .contains(realm.getRealmConfiguration().getAdminRoleName())) { if (log.isDebugEnabled()) { log.debug("Federated user doesn't have super admin role. Unable to sync roles, since" + " super admin role cannot be unassigned from super admin user"); } throw new FrameworkException( "Federated user which having same username to super admin username of local IdP," + " trying login without having super admin role assigned"); } } }
/** * @param roleName * @param realm * @return * @throws UserAdminException */ private boolean isAllowedRoleName(String roleName, UserRealm realm) throws UserAdminException { int index; index = roleName.indexOf("/"); if (index > 0) { roleName = roleName.substring(index + 1); } try { return !realm.getRealmConfiguration().isReservedRoleName(roleName); } catch (UserStoreException e) { throw new UserAdminException(e.getMessage(), e); } }
/** * This method checks whether KDC is enabled. * * @return true if KDC is enabled, else false. * @throws DirectoryServerManagerException If an error occurred while querying user realm. */ public boolean isKDCEnabled() throws DirectoryServerManagerException { try { RealmConfiguration userStoreConfigurations = this.getUserRealm().getRealmConfiguration(); if (userStoreConfigurations != null) { String isKDCEnabled = userStoreConfigurations.getUserStoreProperty (UserCoreConstants.RealmConfig.PROPERTY_KDC_ENABLED); return isKDCEnabled != null && Boolean.parseBoolean(isKDCEnabled); } } catch (UserStoreException e) { log.error("Could not retrieve KDC Enabled parameter.", e); throw new DirectoryServerManagerException("Could not retrieve KDC Enabled parameter.", e); } return false; }
/** * This method checks whether KDC is enabled. * * @return true if KDC is enabled, else false. * @throws DirectoryServerManagerException If an error occurred while querying user realm. */ public boolean isKDCEnabled() throws DirectoryServerManagerException { try { RealmConfiguration userStoreConfigurations = this.getUserRealm().getRealmConfiguration(); if (userStoreConfigurations != null) { String isKDCEnabled = userStoreConfigurations.getUserStoreProperty (UserCoreConstants.RealmConfig.PROPERTY_KDC_ENABLED); return isKDCEnabled != null && Boolean.parseBoolean(isKDCEnabled); } } catch (UserStoreException e) { log.error("Could not retrieve KDC Enabled parameter.", e); throw new DirectoryServerManagerException("Could not retrieve KDC Enabled parameter.", e); } return false; }
/** * This method checks whether KDC is enabled. * * @return true if KDC is enabled, else false. * @throws DirectoryServerManagerException If an error occurred while querying user realm. */ public boolean isKDCEnabled() throws DirectoryServerManagerException { try { RealmConfiguration userStoreConfigurations = this.getUserRealm().getRealmConfiguration(); if (userStoreConfigurations != null) { String isKDCEnabled = userStoreConfigurations.getUserStoreProperty (UserCoreConstants.RealmConfig.PROPERTY_KDC_ENABLED); return isKDCEnabled != null && Boolean.parseBoolean(isKDCEnabled); } } catch (UserStoreException e) { log.error("Could not retrieve KDC Enabled parameter.", e); throw new DirectoryServerManagerException("Could not retrieve KDC Enabled parameter.", e); } return false; }
/** * @param roleName * @param realm * @return * @throws UserAdminException */ private boolean isAllowedRoleName(String roleName, UserRealm realm) throws UserAdminException { if (roleName == null) { return false; } int index; index = roleName.indexOf(CarbonConstants.DOMAIN_SEPARATOR); if (index > 0) { roleName = roleName.substring(index + 1); } try { return !realm.getRealmConfiguration().isReservedRoleName(roleName); } catch (UserStoreException e) { throw new UserAdminException(e.getMessage(), e); } }
/** * Gets the regular expression which defines the format of the service principle, password. * * @return Regular expression. * @throws DirectoryServerManagerException If unable to get RealmConfiguration. */ public String getPasswordConformanceRegularExpression() throws DirectoryServerManagerException { try { RealmConfiguration userStoreConfigurations = this.getUserRealm().getRealmConfiguration(); if (userStoreConfigurations != null) { String passwordRegEx = userStoreConfigurations.getUserStoreProperty( LDAPServerManagerConstants.SERVICE_PASSWORD_REGEX_PROPERTY); if (passwordRegEx == null) { return LDAPServerManagerConstants.DEFAULT_PASSWORD_REGULAR_EXPRESSION; } else { log.info("Service password format is " + passwordRegEx); return passwordRegEx; } } } catch (UserStoreException e) { log.error("Unable to retrieve service password format.", e); throw new DirectoryServerManagerException("Unable to retrieve service password format.", e); } return LDAPServerManagerConstants.DEFAULT_PASSWORD_REGULAR_EXPRESSION; }
private LDAPServerStoreManager getServerStoreManager() throws DirectoryServerManagerException { UserRealm realm = this.getUserRealm(); RealmConfiguration configuration; try { configuration = realm.getRealmConfiguration(); } catch (UserStoreException e) { throw new DirectoryServerManagerException("Unable to retrieve realm configuration.", e); } return new LDAPServerStoreManager(configuration); }
public boolean isReadOnlyUserStore() throws UserProfileException { try { UserRealm realm = getUserRealm(); if ("true".equals(realm.getRealmConfiguration().getUserStoreProperty( UserCoreConstants.RealmConfig.PROPERTY_READ_ONLY))) { return true; } return false; } catch (UserStoreException e) { log.error(e.getMessage(), e); throw new UserProfileException(e.getMessage(), e); } }
private LDAPServerStoreManager getServerStoreManager() throws DirectoryServerManagerException { UserRealm realm = this.getUserRealm(); RealmConfiguration configuration; try { configuration = realm.getRealmConfiguration(); } catch (UserStoreException e) { throw new DirectoryServerManagerException("Unable to retrieve realm configuration.", e); } return new LDAPServerStoreManager(configuration); }
private LDAPServerStoreManager getServerStoreManager() throws DirectoryServerManagerException { UserRealm realm = this.getUserRealm(); RealmConfiguration configuration; try { configuration = realm.getRealmConfiguration(); } catch (UserStoreException e) { throw new DirectoryServerManagerException("Unable to retrieve realm configuration.", e); } return new LDAPServerStoreManager(configuration); }
public boolean isReadOnlyUserStore() throws UserProfileException { try { UserRealm realm = getUserRealm(); if ("true".equals(realm.getRealmConfiguration().getUserStoreProperty( UserCoreConstants.RealmConfig.PROPERTY_READ_ONLY))) { return true; } return false; } catch (UserStoreException e) { log.error(e.getMessage(), e); throw new UserProfileException(e.getMessage(), e); } }
public RealmConfigurationDTO getRealmConfiguration() throws UserStoreException { UserRealm userRealm = getApplicableUserRealm(); RealmConfiguration realmConfig = userRealm.getRealmConfiguration(); RealmConfigurationDTO realmConfigDTO = new RealmConfigurationDTO(); realmConfigDTO.setRealmClassName(realmConfig.getRealmClassName()); realmConfigDTO.setUserStoreClass(realmConfig.getUserStoreClass()); realmConfigDTO.setAuthorizationManagerClass(realmConfig.getAuthorizationManagerClass()); realmConfigDTO.setAdminRoleName(realmConfig.getAdminRoleName()); realmConfigDTO.setAdminUserName(realmConfig.getAdminUserName()); realmConfigDTO.setAdminPassword(realmConfig.getAdminPassword()); realmConfigDTO.setEveryOneRoleName(realmConfig.getEveryOneRoleName()); realmConfigDTO.setUserStoreProperties(getPropertyValueArray(realmConfig .getUserStoreProperties())); realmConfigDTO.setAuthzProperties(getPropertyValueArray(realmConfig.getAuthzProperties())); realmConfigDTO.setRealmProperties(getPropertyValueArray(realmConfig.getRealmProperties())); return realmConfigDTO; }