Package org.apache.shiro.realm.text
Class IniRealm
-
- All Implemented Interfaces:
LogoutAware
,Authorizer
,PermissionResolverAware
,RolePermissionResolverAware
,org.apache.shiro.cache.CacheManagerAware
,Realm
,org.apache.shiro.util.Initializable
,org.apache.shiro.util.Nameable
public class IniRealm extends TextConfigurationRealm
ARealm
implementation that createsSimpleAccount
instances based onIni
configuration. This implementation looks for twosections
in theIni
configuration:[users] # One or more
This class also supports setting theuser definitions
... [roles] # One or morerole definitions
resourcePath
property to create account data from an .ini resource. This will only be used if there isn't already account data in the Realm.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static String
ROLES_SECTION_NAME
static String
USERS_SECTION_NAME
-
Fields inherited from class org.apache.shiro.realm.SimpleAccountRealm
roles, ROLES_LOCK, users, USERS_LOCK
-
-
Constructor Summary
Constructors Constructor Description IniRealm()
IniRealm(String resourcePath)
This constructor will immediately process the definitions in theIni
resolved from the specifiedresourcePath
.IniRealm(org.apache.shiro.config.Ini ini)
This constructor will immediately process the definitions in theIni
argument.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.shiro.config.Ini
getIni()
Returns the Ini instance used to configure this realm.String
getResourcePath()
protected void
onInit()
Will call 'processDefinitions' on startup.void
setIni(org.apache.shiro.config.Ini ini)
Sets the Ini instance used to configure this realm.void
setResourcePath(String resourcePath)
-
Methods inherited from class org.apache.shiro.realm.text.TextConfigurationRealm
getRoleDefinitions, getUserDefinitions, processDefinitions, processRoleDefinitions, processRoleDefinitions, processUserDefinitions, processUserDefinitions, setRoleDefinitions, setUserDefinitions, toLines, toMap
-
Methods inherited from class org.apache.shiro.realm.SimpleAccountRealm
accountExists, add, add, addAccount, addAccount, addRole, doGetAuthenticationInfo, doGetAuthorizationInfo, getRole, getUser, getUsername, getUsername, roleExists, toSet
-
Methods inherited from class org.apache.shiro.realm.AuthorizingRealm
afterCacheManagerSet, checkPermission, checkPermission, checkPermission, checkPermissions, checkPermissions, checkPermissions, checkRole, checkRole, checkRoles, checkRoles, checkRoles, clearCachedAuthorizationInfo, doClearCache, getAuthorizationCache, getAuthorizationCacheKey, getAuthorizationCacheName, getAuthorizationInfo, getPermissionResolver, getPermissions, getRolePermissionResolver, hasAllRoles, hasRole, hasRole, hasRoles, hasRoles, isAuthorizationCachingEnabled, isPermitted, isPermitted, isPermitted, isPermitted, isPermitted, isPermitted, isPermittedAll, isPermittedAll, isPermittedAll, setAuthorizationCache, setAuthorizationCacheName, setAuthorizationCachingEnabled, setName, setPermissionResolver, setRolePermissionResolver
-
Methods inherited from class org.apache.shiro.realm.AuthenticatingRealm
assertCredentialsMatch, clearCachedAuthenticationInfo, getAuthenticationCache, getAuthenticationCacheKey, getAuthenticationCacheKey, getAuthenticationCacheName, getAuthenticationInfo, getAuthenticationTokenClass, getCredentialsMatcher, init, isAuthenticationCachingEnabled, isAuthenticationCachingEnabled, setAuthenticationCache, setAuthenticationCacheName, setAuthenticationCachingEnabled, setAuthenticationTokenClass, setCredentialsMatcher, supports
-
Methods inherited from class org.apache.shiro.realm.CachingRealm
clearCache, getAvailablePrincipal, getCacheManager, getName, isCachingEnabled, onLogout, setCacheManager, setCachingEnabled
-
-
-
-
Field Detail
-
USERS_SECTION_NAME
public static final String USERS_SECTION_NAME
- See Also:
- Constant Field Values
-
ROLES_SECTION_NAME
public static final String ROLES_SECTION_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IniRealm
public IniRealm()
-
IniRealm
public IniRealm(org.apache.shiro.config.Ini ini)
This constructor will immediately process the definitions in theIni
argument. If you need to perform additional configuration before processing (e.g. setting a permissionResolver, etc), do not call this constructor. Instead, do the following:- Call the default no-arg constructor
- Set the Ini instance you wish to use via
#setIni
- Set any other configuration properties
- Call
AuthenticatingRealm.init()
- Parameters:
ini
- the Ini instance which will be inspected to create accounts, groups and permissions for this realm.
-
IniRealm
public IniRealm(String resourcePath)
This constructor will immediately process the definitions in theIni
resolved from the specifiedresourcePath
. If you need to perform additional configuration before processing (e.g. setting a permissionResolver, etc), do not call this constructor. Instead, do the following:- Call the default no-arg constructor
- Set the Ini instance you wish to use via
#setIni
- Set any other configuration properties
- Call
AuthenticatingRealm.init()
- Parameters:
resourcePath
- the resource path of the Ini config which will be inspected to create accounts, groups and permissions for this realm.
-
-
Method Detail
-
getResourcePath
public String getResourcePath()
-
setResourcePath
public void setResourcePath(String resourcePath)
-
getIni
public org.apache.shiro.config.Ini getIni()
Returns the Ini instance used to configure this realm. Provided for JavaBeans-style configuration of this realm, particularly useful in Dependency Injection environments.- Returns:
- the Ini instance which will be inspected to create accounts, groups and permissions for this realm.
-
setIni
public void setIni(org.apache.shiro.config.Ini ini)
Sets the Ini instance used to configure this realm. Provided for JavaBeans-style configuration of this realm, particularly useful in Dependency Injection environments.- Parameters:
ini
- the Ini instance which will be inspected to create accounts, groups and permissions for this realm.
-
onInit
protected void onInit()
Description copied from class:TextConfigurationRealm
Will call 'processDefinitions' on startup.- Overrides:
onInit
in classTextConfigurationRealm
- See Also:
- SHIRO-223
-
-