You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Steffen Otto Jensen <ce...@me.com> on 2011/01/30 23:02:16 UTC

Shiro ini File, Encryption.

Hi'

I'm just starting to learn the Shiro framework. I had been thinking about
what to use for a while, and came across the Video Les made in San Francisco
recently. It's 80minutes long, and does a great job of introducing the
framework. ( http://www.youtube.com/watch?v=5ZepGFzYHpE )

Well, i started coding some, and have a functioning small and simple test
website created. For now i'm sticking with the ini configuration, as i only
need a very small set of users.

However I would like to have the passwords encrypted, and I have thus
inserted the [main] section shown below, together with the rest of my
shiro.ini file. 

[main]
sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
iniRealm.credentialsMatcher = $sha256Matcher

[users]
#steffen = pass, masterrole
steffen = d74ff0ee8da3b9806b18c877dbf29bbde50b5bd8e4dad7a3a725000feb82e8f1,
masterrole
	
[roles]
masterrole = zone1:readonly

This is done according to the instructions from the documentation:
http://shiro.apache.org/configuration.html#Configuration-EncryptingPasswords

I believe, but I get an error when the webapp loads during server startup.
Here you have a stack trace:


Jan 30, 2011 10:25:01 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal
performance in production environments was not found on the
java.library.path:
.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Jan 30, 2011 10:25:01 PM org.apache.tomcat.util.digester.SetPropertiesRule
begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting
property 'source' to 'org.eclipse.jst.jee.server:ShiroTest' did not find a
matching property.
Jan 30, 2011 10:25:01 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 30, 2011 10:25:01 PM org.apache.coyote.ajp.AjpProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
Jan 30, 2011 10:25:01 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 962 ms
Jan 30, 2011 10:25:01 PM org.apache.catalina.core.StandardService
startInternal
INFO: Starting service Catalina
Jan 30, 2011 10:25:01 PM org.apache.catalina.core.StandardEngine
startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.5
9 [main] INFO org.apache.shiro.web.servlet.IniShiroFilter - Null or empty
configuration specified via 'config' init-param.  Checking path-based
configuration.
10 [main] INFO org.apache.shiro.web.servlet.IniShiroFilter - Null or empty
configuration specified via 'config' or 'configPath' filter parameters. 
Trying the default classpath:shiro.ini file.
Jan 30, 2011 10:25:02 PM org.apache.catalina.core.StandardContext
filterStart
SEVERE: Exception starting filter ShiroFilter
java.lang.NoClassDefFoundError: org/apache/commons/beanutils/PropertyUtils
	at
org.apache.shiro.config.ReflectionBuilder.isTypedProperty(ReflectionBuilder.java:239)
	at
org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:347)
	at
org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:198)
	at
org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:159)
	at
org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:119)
	at
org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:170)
	at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:119)
	at
org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:97)
	at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:83)
	at
org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:41)
	at
org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at
org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at
org.apache.shiro.web.servlet.IniShiroFilter.applySecurityManager(IniShiroFilter.java:353)
	at
org.apache.shiro.web.servlet.IniShiroFilter.configure(IniShiroFilter.java:321)
	at
org.apache.shiro.web.servlet.IniShiroFilter.init(IniShiroFilter.java:292)
	at
org.apache.shiro.web.servlet.AbstractShiroFilter.onFilterConfigSet(AbstractShiroFilter.java:83)
	at org.apache.shiro.web.servlet.AbstractFilter.init(AbstractFilter.java:94)
	at
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
	at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
	at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
	at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
	at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4405)
	at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5037)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
	at
org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:738)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
	at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:289)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:442)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:674)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:596)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
Caused by: java.lang.ClassNotFoundException:
org.apache.commons.beanutils.PropertyUtils
	at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1671)
	at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
	... 41 more
Jan 30, 2011 10:25:02 PM org.apache.catalina.core.StandardContext
startInternal
SEVERE: Error filterStart
Jan 30, 2011 10:25:02 PM org.apache.catalina.core.StandardContext
startInternal
SEVERE: Context [/ShiroTest] startup failed due to previous errors
Jan 30, 2011 10:25:03 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 30, 2011 10:25:03 PM org.apache.coyote.ajp.AjpProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Jan 30, 2011 10:25:03 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1194 ms

I have spent about an hour looking through the source, but without any
breakthroughs.

Any help would be much appreciated.

Kind regards
Steffen
-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-ini-File-Encryption-tp5975559p5975559.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Shiro ini File, Encryption.

Posted by Steffen Otto Jensen <ce...@me.com>.
Kalle, Thank you for your help.

However I was just about to post the same resolution.

I'm not using maven, as I haven't gotten around to figuring that system out
yet. But I guess maven can be your friend.. As I understand i does automatic
dependency management. I found the resolution by looking at the pom.xml
file. Afterwards looking through the stack trace, it was kind of obvious
too.

In addition to the commons-beanutils, it needed the commons-logging also.
And then it worked like a charm with the encrypted passwords.

Thanks again for your quick reply.

-Steffen

-- 
View this message in context: http://shiro-user.582556.n2.nabble.com/Re-Shiro-ini-File-Encryption-tp5975628p5975659.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: Shiro ini File, Encryption.

Posted by Kalle Korhonen <ka...@gmail.com>.
You need commons-beanutils in your classpath. See
http://shiro.apache.org/static/current/shiro-core/dependencies.html
and http://commons.apache.org/beanutils/

Kalle


On Sun, Jan 30, 2011 at 2:02 PM, Steffen Otto Jensen <ce...@me.com> wrote:
>
> Hi'
>
> I'm just starting to learn the Shiro framework. I had been thinking about
> what to use for a while, and came across the Video Les made in San Francisco
> recently. It's 80minutes long, and does a great job of introducing the
> framework. ( http://www.youtube.com/watch?v=5ZepGFzYHpE )
>
> Well, i started coding some, and have a functioning small and simple test
> website created. For now i'm sticking with the ini configuration, as i only
> need a very small set of users.
>
> However I would like to have the passwords encrypted, and I have thus
> inserted the [main] section shown below, together with the rest of my
> shiro.ini file.
>
> [main]
> sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
> iniRealm.credentialsMatcher = $sha256Matcher
>
> [users]
> #steffen = pass, masterrole
> steffen = d74ff0ee8da3b9806b18c877dbf29bbde50b5bd8e4dad7a3a725000feb82e8f1,
> masterrole
>
> [roles]
> masterrole = zone1:readonly
>
> This is done according to the instructions from the documentation:
> http://shiro.apache.org/configuration.html#Configuration-EncryptingPasswords
>
> I believe, but I get an error when the webapp loads during server startup.
> Here you have a stack trace:
>
>
> Jan 30, 2011 10:25:01 PM org.apache.catalina.core.AprLifecycleListener init
> INFO: The APR based Apache Tomcat Native library which allows optimal
> performance in production environments was not found on the
> java.library.path:
> .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
> Jan 30, 2011 10:25:01 PM org.apache.tomcat.util.digester.SetPropertiesRule
> begin
> WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting
> property 'source' to 'org.eclipse.jst.jee.server:ShiroTest' did not find a
> matching property.
> Jan 30, 2011 10:25:01 PM org.apache.coyote.http11.Http11Protocol init
> INFO: Initializing Coyote HTTP/1.1 on http-8080
> Jan 30, 2011 10:25:01 PM org.apache.coyote.ajp.AjpProtocol init
> INFO: Initializing Coyote AJP/1.3 on ajp-8009
> Jan 30, 2011 10:25:01 PM org.apache.catalina.startup.Catalina load
> INFO: Initialization processed in 962 ms
> Jan 30, 2011 10:25:01 PM org.apache.catalina.core.StandardService
> startInternal
> INFO: Starting service Catalina
> Jan 30, 2011 10:25:01 PM org.apache.catalina.core.StandardEngine
> startInternal
> INFO: Starting Servlet Engine: Apache Tomcat/7.0.5
> 9 [main] INFO org.apache.shiro.web.servlet.IniShiroFilter - Null or empty
> configuration specified via 'config' init-param.  Checking path-based
> configuration.
> 10 [main] INFO org.apache.shiro.web.servlet.IniShiroFilter - Null or empty
> configuration specified via 'config' or 'configPath' filter parameters.
> Trying the default classpath:shiro.ini file.
> Jan 30, 2011 10:25:02 PM org.apache.catalina.core.StandardContext
> filterStart
> SEVERE: Exception starting filter ShiroFilter
> java.lang.NoClassDefFoundError: org/apache/commons/beanutils/PropertyUtils
>        at
> org.apache.shiro.config.ReflectionBuilder.isTypedProperty(ReflectionBuilder.java:239)
>        at
> org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:347)
>        at
> org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:198)
>        at
> org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:159)
>        at
> org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:119)
>        at
> org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:170)
>        at
> org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:119)
>        at
> org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:97)
>        at
> org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:83)
>        at
> org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:41)
>        at
> org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
>        at
> org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
>        at
> org.apache.shiro.web.servlet.IniShiroFilter.applySecurityManager(IniShiroFilter.java:353)
>        at
> org.apache.shiro.web.servlet.IniShiroFilter.configure(IniShiroFilter.java:321)
>        at
> org.apache.shiro.web.servlet.IniShiroFilter.init(IniShiroFilter.java:292)
>        at
> org.apache.shiro.web.servlet.AbstractShiroFilter.onFilterConfigSet(AbstractShiroFilter.java:83)
>        at org.apache.shiro.web.servlet.AbstractFilter.init(AbstractFilter.java:94)
>        at
> org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
>        at
> org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
>        at
> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
>        at
> org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
>        at
> org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4405)
>        at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5037)
>        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
>        at
> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
>        at
> org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:738)
>        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
>        at
> org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1035)
>        at
> org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:289)
>        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
>        at
> org.apache.catalina.core.StandardService.startInternal(StandardService.java:442)
>        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
>        at
> org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:674)
>        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
>        at org.apache.catalina.startup.Catalina.start(Catalina.java:596)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
>        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.beanutils.PropertyUtils
>        at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1671)
>        at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
>        ... 41 more
> Jan 30, 2011 10:25:02 PM org.apache.catalina.core.StandardContext
> startInternal
> SEVERE: Error filterStart
> Jan 30, 2011 10:25:02 PM org.apache.catalina.core.StandardContext
> startInternal
> SEVERE: Context [/ShiroTest] startup failed due to previous errors
> Jan 30, 2011 10:25:03 PM org.apache.coyote.http11.Http11Protocol start
> INFO: Starting Coyote HTTP/1.1 on http-8080
> Jan 30, 2011 10:25:03 PM org.apache.coyote.ajp.AjpProtocol start
> INFO: Starting Coyote AJP/1.3 on ajp-8009
> Jan 30, 2011 10:25:03 PM org.apache.catalina.startup.Catalina start
> INFO: Server startup in 1194 ms
>
> I have spent about an hour looking through the source, but without any
> breakthroughs.
>
> Any help would be much appreciated.
>
> Kind regards
> Steffen
> --
> View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-ini-File-Encryption-tp5975559p5975559.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>