Methods Summary |
---|
protected java.util.Set | _getAttributeNames()
final Set<String> attrNames = super._getAttributeNames();
if ( isStdFileRealm() )
{
attrNames.add( GROUP_NAMES_ATTR );
attrNames.add( USER_NAMES_ATTR );
}
return attrNames;
|
private void | checkRealmType()
if ( ! isStdFileRealm() )
{
throw new IllegalArgumentException(
"AuthRealm type " + getClassname() +" not supported." );
}
|
private AuthRealmSupport | createSupport()
AuthRealmSupport support = null;
if ( isStdFileRealm() )
{
String file = null;
try
{
file = getFile();
}
catch( Exception e )
{
// some realms are malformed
}
if ( file != null && file.indexOf( TEMPLATE_PREFIX ) < 0 )
{
support = new AuthRealmSupport( this );
}
else if ( file != null )
{
// can't support it
}
}
return support;
|
public java.lang.Object | getAttribute(java.lang.String attrName)
Object result = null;
if ( GROUP_NAMES_ATTR.equals( attrName ) )
{
checkRealmType();
result = mSupport.getGroupNames();
//sdebug( "GroupNames: " + StringUtil.toString( (String[])result ) );
}
else if ( USER_NAMES_ATTR.equals( attrName ) )
{
checkRealmType();
result = mSupport.getUserNames();
//sdebug( "UserNames: " + StringUtil.toString( (String[])result ) );
}
else
{
result = super.getAttribute( attrName );
}
return result;
|
protected java.lang.Class | getAttributeClass(java.lang.String attrName)
Class result = null;
if ( isStdFileRealm() &&
( GROUP_NAMES_ATTR.equals( attrName ) ||
USER_NAMES_ATTR.equals( attrName ) ) )
{
result = String[].class;
}
else
{
result = super.getAttributeClass( attrName );
}
return result;
|
public java.lang.String | getClassname()
try
{
return (String)getAttribute( "Classname" );
}
catch( AttributeNotFoundException e )
{
e.printStackTrace();
throw new RuntimeException( e );
}
|
public java.lang.String | getFile()
return getPropertyValue( "file" );
|
public java.lang.Object | handleInvoke(java.lang.String operationName, java.lang.Object[] args, java.lang.String[] types)
Object result = null;
if(args == null)
{
unsupportedOperation( operationName, args, types );
}
final int numArgs = args.length;
if ( isStdFileRealm() &&
SUPPORTED_OPERATIONS.contains( operationName ) && numArgs >= 1 )
{
final String user = (String)args[ 0 ];
if ( operationName.equals( "getUserGroupNames" ) && numArgs == 1)
{
result = mSupport.getUserGroupNames( user );
}
else if ( operationName.equals( "addUser" ) && numArgs == 3)
{
final String password = (String)args[ 1 ];
final String[] groupList = (String[])args[ 2 ];
mSupport.addUser( user, password, groupList );
}
else if ( operationName.equals( "updateUser" ) && numArgs == 3)
{
final String password = (String)args[ 1 ];
final String[] groupList = (String[])args[ 2 ];
mSupport.updateUser( user, password, groupList );
}
else if ( operationName.equals( "removeUser" ) && numArgs == 1)
{
mSupport.removeUser( user );
}
else
{
unsupportedOperation( operationName, args, types );
}
}
else
{
unsupportedOperation( operationName, args, types );
}
//sdebug( "handleInvoke: " + operationName + "(): " + result );
return result;
|
private boolean | isStdFileRealm()
return AuthRealmConfig.DEFAULT_REALM_CLASSNAME.equals( getClassname() );
|