use of com.sun.enterprise.security.auth.realm.Realm in project Payara by payara.
the class RealmsImpl method getRealm.
private Realm getRealm(String realmName) {
loadRealms();
Realm realm = getRealmsManager().getFromLoadedRealms(realmName);
if (realm == null) {
throw new IllegalArgumentException("No such realm: " + realmName);
}
return realm;
}
use of com.sun.enterprise.security.auth.realm.Realm in project Payara by payara.
the class RealmsImpl method updateUser.
public void updateUser(String realmName, String existingUser, String newUser, String password, String[] groupList) {
checkSupportsUserManagement(realmName);
try {
Realm realm = getRealm(realmName);
realm.updateUser(existingUser, newUser, password.toCharArray(), groupList);
realm.persist();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.sun.enterprise.security.auth.realm.Realm in project Payara by payara.
the class SecurityUtil method addUser.
public void addUser(String realmName, String user, String password, String[] groupList) {
checkSupportsUserManagement(realmName);
try {
Realm realm = getRealm(realmName);
realm.addUser(user, password.toCharArray(), groupList);
realm.persist();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.sun.enterprise.security.auth.realm.Realm in project Payara by payara.
the class SupportsUserManagementCommand method supportsUserManagement.
private boolean supportsUserManagement(String realmName) throws BadRealmException, NoSuchRealmException {
Realm realm = realmsManager.getFromLoadedRealms(config.getName(), realmName);
if (realm != null) {
return realm.supportsUserManagement();
}
List<AuthRealm> authRealmConfigs = config.getSecurityService().getAuthRealm();
for (AuthRealm authRealm : authRealmConfigs) {
if (realmName.equals(authRealm.getName())) {
List<Property> propConfigs = authRealm.getProperty();
Properties props = new Properties();
for (Property p : propConfigs) {
String value = p.getValue();
props.setProperty(p.getName(), value);
}
realm = Realm.instantiate(authRealm.getName(), authRealm.getClassname(), props, config.getName());
return realm.supportsUserManagement();
}
}
throw new NoSuchRealmException(_localStrings.getLocalString("NO_SUCH_REALM", "No Such Realm: {0}", realmName));
}
use of com.sun.enterprise.security.auth.realm.Realm in project Payara by payara.
the class SecurityUtil method updateUser.
public void updateUser(String realmName, String existingUser, String newUser, String password, String[] groupList) {
checkSupportsUserManagement(realmName);
try {
Realm realm = getRealm(realmName);
realm.updateUser(existingUser, newUser, password.toCharArray(), groupList);
realm.persist();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations