Hi Brian,
1-3) I tried with Servket Filter and without it anyway onInit method is called
twice. It seems to be bug.
4) As I see you have same packages for different modules, for example
shiro/core/src/main/java/org/apache/shiro/config
shiro/config/core/src/main/java/org/apache/shiro/config
Besides I found this issue — https://issues.apache.org/jira/browse/SHIRO-679
5) I understood that you don’t have sources and javadoc for shiro-all. Maybe
there is sense to add them?
If people can’t use your modules, please, make their lives easier.
Best regards, Alex
>Четверг, 7 мая 2020, 1:25 +03:00 от Brian Demers <[email protected]>:
>
>Hi Alex,
>
>
>1-3.)
>Do you also have the Shiro Servlet Filter configured?
>
>4.) We don't currently generate module-info metadata, but if there is
>something that isn't working for you please start another thread :)
>
>5.) We don't have sources & Javadoc jars for `shiro-all` we only produce them
>for the individual modules.
>
>On Wed, May 6, 2020 at 4:23 AM Alex Sviridov < [email protected] > wrote:
>>Hi Brian,
>>
>>Thank you for quick answer.
>>
>>1) This is my shiro.ini
>>
>>[main]
>>cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
>>securityManager.cacheManager = $cacheManager
>>realm = com.foo.TestRealm
>>securityManager.realms = $realm
>>
>>2) This is my init code:
>>
>> Environment env = new BasicIniEnvironment(url.toString());
>> final SecurityManager securityManager = env.getSecurityManager();
>> SecurityUtils.setSecurityManager(securityManager);
>>
>>3) This is my TestRealm
>>
>>public class TestRealm extends AuthenticatingRealm {
>>
>> private static final Logger logger =
>>LoggerFactory.getLogger(TestRealm.class);
>> @Override
>> protected void onInit() {
>> logger.info ("************************************On INIT");
>> try {
>> throw new Exception();
>> } catch (Exception ex) {
>> logger.error("Error", ex);
>> }
>> setCredentialsMatcher((AuthenticationToken at, AuthenticationInfo ai)
>>-> {
>> logger.info ("################################ [{}], [{}]", at,
>>ai);
>> return false;
>> });
>>
>> }
>>
>>
>> @Override
>> protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
>>token) throws AuthenticationException {
>> UsernamePasswordToken upToken = (UsernamePasswordToken) token;
>> logger.info ("REALM username [{}], password [{}]",
>>upToken.getUsername(), upToken.getPassword());
>> return new SimpleAuthenticationInfo(new UserEntity(), null ,
>>getName());
>> }
>>
>>}
>>
>>
>>4) I tried to use shiro-core + shiro-web, but it seems to be impossible to use
>>shiro modules in jpms environment, so, I had to take shiro-all.
>>
>>5) By the way, I couldn’t find javadoc and sources for shiro-al in maven repo
>>https://repo1.maven.org/maven2/org/apache/shiro/shiro-all/1.5.3/
>>
>>Best regards, Alex
>>
>>>Среда, 6 мая 2020, 4:09 +03:00 от Brian Demers < [email protected] >:
>>>
>>>It depends, we would need to see the full stack trace, it's unclear what is
>>>setting up your environment. How are you configuring Shiro?
>>>
>>>Also, I'd recommend against using the `shiro-all` and instead use
>>>`shiro-web`
>>>On Tue, May 5, 2020 at 7:01 PM Alex Sviridov < [email protected] > wrote:
>>>>Hi all,
>>>>
>>>>I am just learning Shiro, but I noticed that onInit method on on
>>>>AuthenticatingRealm
>>>>is called twice. I have one TestRealm and this is stacktrace:
>>>>
>>>>First call:
>>>>
>>>> at com.foo.TestRealm.onInit(TestRealm.java:37) [classes/:?]
>>>> at
>>>>org.apache.shiro.realm.AuthenticatingRealm.init(AuthenticatingRealm.java:398)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
>>>>[shiro-all-1.5.3.jar:?]
>>>> at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
>>>>[shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.ReflectionBuilder$BeanConfigurationProcessor.execute(ReflectionBuilder.java:829)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:288)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:181)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:139)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:107)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:98)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:47)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:150)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
>>>>[shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.env.BasicIniEnvironment.<init>(BasicIniEnvironment.java:37)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.env.BasicIniEnvironment.<init>(BasicIniEnvironment.java:41)
>>>> [shiro-all-1.5.3.jar:?]
>>>>
>>>>
>>>>Second call:
>>>>
>>>> at com.foo.TestRealm.onInit(TestRealm.java:37) [classes/:?]
>>>> at
>>>>org.apache.shiro.realm.AuthenticatingRealm.init(AuthenticatingRealm.java:398)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
>>>>[shiro-all-1.5.3.jar:?]
>>>> at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
>>>>[shiro-all-1.5.3.jar:?]
>>>> at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:61)
>>>>[shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:292)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:181)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:139)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:107)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:98)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:47)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:150)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
>>>>[shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.env.BasicIniEnvironment.<init>(BasicIniEnvironment.java:37)
>>>> [shiro-all-1.5.3.jar:?]
>>>> at
>>>>org.apache.shiro.env.BasicIniEnvironment.<init>(BasicIniEnvironment.java:41)
>>>> [shiro-all-1.5.3.jar:?]
>>>>
>>>>Could anyone say if it is a bug or it was done intentionally?
>>>>
>>>>--
>>>>Best regards, Alex Sviridov
>>
>>
>>--
>>Alex Sviridov
>>
--
Alex Sviridov