Methods Summary |
---|
public void | addUser(java.lang.String userName, java.lang.String password, java.lang.String[] groupList)Adds new user to file realm. User cannot exist already.
final FileRealm realm = getRealmKeyFile();
try
{
realm.addUser(userName, password, groupList);
saveInstanceRealmKeyFile(realm);
}
catch(Exception e)
{
throw new MBeanConfigException( e.getMessage() );
}
|
public java.lang.String[] | getGroupNames()Returns names of all the groups from the instance realm keyfile
final FileRealm realm = getRealmKeyFile();
try
{
return toStringArray(realm.getGroupNames());
}
catch(BadRealmException bre)
{
throw new MBeanConfigException(bre.getMessage());
}
|
private com.sun.enterprise.security.auth.realm.file.FileRealm | getRealmKeyFile()
try
{
return new FileRealm( mFile );
}
catch(Exception e)
{
throw new MBeanConfigException( e.getMessage() );
}
|
public java.lang.String[] | getUserGroupNames(java.lang.String userName)Returns the name of all the groups that this user belongs to from the instance realm keyfile
if( userName == null )
{
throw new IllegalArgumentException( "" + null );
}
final FileRealm realm = getRealmKeyFile();
try
{
return toStringArray(realm.getGroupNames(userName));
}
catch(NoSuchUserException nse)
{
throw new MBeanConfigException(nse.getMessage());
}
|
public java.lang.String[] | getUserNames()
final FileRealm realm = getRealmKeyFile();
try
{
return toStringArray(realm.getUserNames());
}
catch(BadRealmException bre)
{
throw new MBeanConfigException(bre.getMessage());
}
|
public void | removeUser(java.lang.String userName)Remove user from file realm. User must exist.
final FileRealm realm = getRealmKeyFile();
try
{
realm.removeUser(userName);
saveInstanceRealmKeyFile(realm);
}
catch(NoSuchUserException nse)
{
throw new MBeanConfigException(nse.getMessage());
}
|
private void | saveInstanceRealmKeyFile(com.sun.enterprise.security.auth.realm.file.FileRealm realm)
try
{
realm.writeKeyFile( mFile );
}
catch(IOException e)
{
throw new MBeanConfigException( e.getMessage() );
}
|
private static java.lang.String[] | toStringArray(java.util.Enumeration e)
final List<String> list = new ArrayList<String>();
while( e.hasMoreElements() )
{
list.add( "" + e.nextElement() );
}
return CollectionUtil.toStringArray( list );
|
public void | updateUser(java.lang.String userName, java.lang.String password, java.lang.String[] groupList)Update data for an existing user. User must exist.
This is equivalent to calling removeUser() followed by addUser().
final FileRealm realm = getRealmKeyFile();
try
{
realm.updateUser(userName, userName, password, groupList);
saveInstanceRealmKeyFile( realm );
}
catch( Exception e )
{
throw new MBeanConfigException( e .getMessage() );
}
|