TextConfigurationRealm

A SimpleAccountRealm that enables text-based configuration of the initial User, Role, and Permission objects created at startup. <p/> Each User account definition specifies the username, password, and roles for a user. Each Role definition specifies a name and an optional collection of assigned Permissions. Users can be assigned Roles, and Roles can be assigned Permissions. By transitive association, each User 'has' all of their Role's Permissions. <p/> User and user-to-role definitions are specified via the {@link #setUserDefinitions} method and Role-to-permission definitions are specified via the {@link #setRoleDefinitions} method.

Constructors

this
this()
Undocumented in source.

Members

Functions

getRoleDefinitions
string getRoleDefinitions()
Undocumented in source. Be warned that the author may not have intended to support it.
getUserDefinitions
string getUserDefinitions()
Undocumented in source. Be warned that the author may not have intended to support it.
onInit
void onInit()

Will call 'processDefinitions' on startup.

processDefinitions
void processDefinitions()
Undocumented in source. Be warned that the author may not have intended to support it.
processRoleDefinitions
void processRoleDefinitions()
Undocumented in source. Be warned that the author may not have intended to support it.
processRoleDefinitions
void processRoleDefinitions(Map!(string, string) roleDefs)
Undocumented in source. Be warned that the author may not have intended to support it.
processUserDefinitions
void processUserDefinitions()
Undocumented in source. Be warned that the author may not have intended to support it.
processUserDefinitions
void processUserDefinitions(Map!(string, string) userDefs)
Undocumented in source. Be warned that the author may not have intended to support it.
setRoleDefinitions
void setRoleDefinitions(string roleDefinitions)

Sets a newline (\n) delimited string that defines role-to-permission definitions. <p/> <p>Each line within the string must define a role-to-permission(s) key/value mapping with the equals character signifies the key/value separation, like so:</p> <p/> <p><code><em>rolename</em> = <em>permissionDefinition1</em>, <em>permissionDefinition2</em>, ...</code></p> <p/> <p>where <em>permissionDefinition</em> is an arbitrary string, but must people will want to use Strings that conform to the {@link hunt.shiro.authz.permission.WildcardPermission WildcardPermission} format for ease of use and flexibility. Note that if an individual <em>permissionDefinition</em> needs to be internally comma-delimited (e.g. <code>printer:5thFloor:print,info</code>), you will need to surround that definition with double quotes (&quot;) to avoid parsing errors (e.g. <code>&quot;printer:5thFloor:print,info&quot;</code>). <p/> <p><b>NOTE:</b> if you have roles that don't require permission associations, don't include them in this definition - just defining the role name in the {@link #setUserDefinitions(string) userDefinitions} is enough to create the role if it does not yet exist. This property is really only for configuring realms that have one or more assigned Permission.

setUserDefinitions
void setUserDefinitions(string userDefinitions)

<p>Sets a newline (\n) delimited string that defines user-to-password-and-role(s) key/value pairs according to the following format: <p/> <p><code><em>username</em> = <em>password</em>, role1, role2,...</code></p> <p/> <p>Here are some examples of what these lines might look like:</p> <p/> <p><code>root = <em>reallyHardToGuessPassword</em>, administrator<br/> jsmith = <em>jsmithsPassword</em>, manager, engineer, employee<br/> abrown = <em>abrownsPassword</em>, qa, employee<br/> djones = <em>djonesPassword</em>, qa, contractor<br/> guest = <em>guestPassword</em></code></p>

Static functions

toLines
Set!(string) toLines(string s)
Undocumented in source. Be warned that the author may not have intended to support it.
toMap
Map!(string, string) toMap(Collection!(string) keyValuePairs)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From SimpleAccountRealm

users
Map!(string, SimpleAccount) users;
Undocumented in source.
roles
Map!(string, SimpleRole) roles;
Undocumented in source.
USERS_LOCK
ReadWriteMutex USERS_LOCK;
Undocumented in source.
ROLES_LOCK
ReadWriteMutex ROLES_LOCK;
Undocumented in source.
getUser
SimpleAccount getUser(string username)
Undocumented in source. Be warned that the author may not have intended to support it.
accountExists
bool accountExists(string username)
Undocumented in source. Be warned that the author may not have intended to support it.
addAccount
void addAccount(string username, string password)
Undocumented in source. Be warned that the author may not have intended to support it.
addAccount
void addAccount(string username, string password, string[] roles)
Undocumented in source. Be warned that the author may not have intended to support it.
getUsername
string getUsername(SimpleAccount account)
Undocumented in source. Be warned that the author may not have intended to support it.
getUsername
string getUsername(PrincipalCollection principals)
Undocumented in source. Be warned that the author may not have intended to support it.
add
void add(SimpleAccount account)
Undocumented in source. Be warned that the author may not have intended to support it.
getRole
SimpleRole getRole(string rolename)
Undocumented in source. Be warned that the author may not have intended to support it.
roleExists
bool roleExists(string name)
Undocumented in source. Be warned that the author may not have intended to support it.
addRole
void addRole(string name)
Undocumented in source. Be warned that the author may not have intended to support it.
add
void add(SimpleRole role)
Undocumented in source. Be warned that the author may not have intended to support it.
toSet
Set!(string) toSet(string delimited, string delimiter)
Undocumented in source. Be warned that the author may not have intended to support it.
doGetAuthenticationInfo
AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
Undocumented in source. Be warned that the author may not have intended to support it.
doGetAuthorizationInfo
AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta