/** * This constructor will immediately process the definitions in the {@code Ini} 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: * <ol> * <li>Call the default no-arg constructor</li> * <li>Set the Ini instance you wish to use via {@code #setIni}</li> * <li>Set any other configuration properties</li> * <li>Call {@link #init()}</li> * </ol> * * @param ini the Ini instance which will be inspected to create accounts, groups and permissions for this realm. */ public IniRealm(Ini ini) { this(); processDefinitions(ini); }
/** * This constructor will immediately process the definitions in the {@code Ini} resolved from the specified * {@code resourcePath}. If you need to perform additional configuration before processing (e.g. setting a * permissionResolver, etc), do not call this constructor. Instead, do the following: * <ol> * <li>Call the default no-arg constructor</li> * <li>Set the Ini instance you wish to use via {@code #setIni}</li> * <li>Set any other configuration properties</li> * <li>Call {@link #init()}</li> * </ol> * * @param resourcePath the resource path of the Ini config which will be inspected to create accounts, groups and * permissions for this realm. */ public IniRealm(String resourcePath) { this(); Ini ini = Ini.fromResourcePath(resourcePath); this.ini = ini; this.resourcePath = resourcePath; processDefinitions(ini); }
/** * This constructor will immediately process the definitions in the {@code Ini} 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: * <ol> * <li>Call the default no-arg constructor</li> * <li>Set the Ini instance you wish to use via {@code #setIni}</li> * <li>Set any other configuration properties</li> * <li>Call {@link #init()}</li> * </ol> * * @param ini the Ini instance which will be inspected to create accounts, groups and permissions for this realm. */ public IniRealm(Ini ini) { this(); processDefinitions(ini); }
/** * This constructor will immediately process the definitions in the {@code Ini} resolved from the specified * {@code resourcePath}. If you need to perform additional configuration before processing (e.g. setting a * permissionResolver, etc), do not call this constructor. Instead, do the following: * <ol> * <li>Call the default no-arg constructor</li> * <li>Set the Ini instance you wish to use via {@code #setIni}</li> * <li>Set any other configuration properties</li> * <li>Call {@link #init()}</li> * </ol> * * @param resourcePath the resource path of the Ini config which will be inspected to create accounts, groups and * permissions for this realm. */ public IniRealm(String resourcePath) { this(); Ini ini = Ini.fromResourcePath(resourcePath); this.ini = ini; this.resourcePath = resourcePath; processDefinitions(ini); }
public IniRealm(Ini ini) { this(); processDefinitions(ini); }
public IniRealm(String resourcePath) { this(); Ini ini = Ini.fromResourcePath(resourcePath); this.resourcePath = resourcePath; processDefinitions(ini); }
@Override protected void onInit() { // This is an in-memory realm only - no need for an additional cache when we're already // as memory-efficient as we can be. String resourcePath = getResourcePath(); if (CollectionUtils.isEmpty(this.users) && CollectionUtils.isEmpty(this.roles)) { //no account data manually populated - try the resource path: if (StringUtils.hasText(resourcePath)) { log.debug("Resource path {} defined. Creating INI instance.", resourcePath); Ini ini = Ini.fromResourcePath(resourcePath); processDefinitions(ini); } else { throw new IllegalStateException("No resource path was specified. Cannot load account data."); } } else { if (StringUtils.hasText(resourcePath)) { log.warn("Users or Roles are already populated. Resource path property will be ignored."); } } }