Re: What should deprecated class WebIniSecurityManagerFactory be replaced with in OSGi?

2019-06-27 Thread Steinar Bang
> Brian Demers :

> I'm guessing in your case you might want to do something similar to what we
> do for Guice (create a WebEnvironment implementation)
> https://github.com/apache/shiro/blob/master/support/guice/src/main/java/org/apache/shiro/guice/web/WebGuiceEnvironment.java

> For the SecurityManager, you should just be able to create a new instance
> and use/inject that.

Thanks, Brian!   :-)

I'm able to create a DefaultWebSecurityManager with new, but I couldn't
figure out how to read in the shiro.ini configuration...?


[GitHub] [shiro] fpapon commented on a change in pull request #157: SHIRO-712 - Add BasicIniEnvironment

2019-06-27 Thread GitBox
fpapon commented on a change in pull request #157: SHIRO-712 - Add 
BasicIniEnvironment
URL: https://github.com/apache/shiro/pull/157#discussion_r298365728
 
 

 ##
 File path: core/src/main/java/org/apache/shiro/env/BasicIniEnvironment.java
 ##
 @@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.shiro.env;
+
+import org.apache.shiro.config.Ini;
+import org.apache.shiro.config.IniSecurityManagerFactory;
+import org.apache.shiro.mgt.SecurityManager;
+
+/**
+ * Basic usage:
+ * 
+ * Environment env = new BasicIniEnvironment("classpath:shiro.ini");
+ * SecurityManager securityManager = env.getSecurityManager();
+ * 
+ *
+ */
+public class BasicIniEnvironment extends DefaultEnvironment {
+
+public BasicIniEnvironment(Ini ini) {
+setSecurityManager(new IniSecurityManagerFactory(ini).getInstance());
 
 Review comment:
   `IniSecurityManagerFactory` is deprecated, @bdemers should we still use it?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


Re: What should deprecated class WebIniSecurityManagerFactory be replaced with in OSGi?

2019-06-27 Thread Brian Demers
We should have added the javadoc tag leaving instructions on what to do.

I'm guessing in your case you might want to do something similar to what we
do for Guice (create a WebEnvironment implementation)
https://github.com/apache/shiro/blob/master/support/guice/src/main/java/org/apache/shiro/guice/web/WebGuiceEnvironment.java

For the SecurityManager, you should just be able to create a new instance
and use/inject that.

Let me know how it goes!
-Brian


On Thu, Jun 27, 2019 at 12:43 PM Steinar Bang  wrote:

> In my Shiro-in-OSGi-configured-by-code solutions I ended up using
> the deprecated WebIniSecurityManagerFactory, with some tricks to find
> the shiro.ini file in the OSGi classpath:
>
> https://github.com/steinarb/authservice/blob/master/authservice.web.security/src/main/java/no/priv/bang/authservice/web/security/AuthserviceShiroFilter.java#L73
>
> https://github.com/steinarb/ukelonn/blob/master/ukelonn.web.security/src/main/java/no/priv/bang/ukelonn/web/security/UkelonnShiroFilter.java#L69
>
> https://github.com/steinarb/handlereg/blob/master/handlereg.web.security/src/main/java/no/priv/bang/handlereg/web/security/HandleregShiroFilter.java#L65
>
> https://github.com/steinarb/authservice-sampleclient/blob/master/src/main/java/no/priv/bang/authservice/sampleclient/AuthserviceSampleClientShiroFilter.java#L73
>
> The only thing the shiro.ini is used for is path to user/role/permission
> mapping inside the webapps.
>
> Configuration outside of path access, is a combination of configuration
> by code in the activate methods of DS components, and OSGi service
> injections into the same DS components (Realm and SessionDAO are
> injected).
>
> However, the class I use to start the configuration in the activate
> metods, WebIniSecurityManagerFactory, is deprecated.
>
> What should I use instead?
>
>
> Thanks!
>
>
> - Steinar
>


What should deprecated class WebIniSecurityManagerFactory be replaced with in OSGi?

2019-06-27 Thread Steinar Bang
In my Shiro-in-OSGi-configured-by-code solutions I ended up using
the deprecated WebIniSecurityManagerFactory, with some tricks to find
the shiro.ini file in the OSGi classpath:
 
https://github.com/steinarb/authservice/blob/master/authservice.web.security/src/main/java/no/priv/bang/authservice/web/security/AuthserviceShiroFilter.java#L73
 
https://github.com/steinarb/ukelonn/blob/master/ukelonn.web.security/src/main/java/no/priv/bang/ukelonn/web/security/UkelonnShiroFilter.java#L69
 
https://github.com/steinarb/handlereg/blob/master/handlereg.web.security/src/main/java/no/priv/bang/handlereg/web/security/HandleregShiroFilter.java#L65
 
https://github.com/steinarb/authservice-sampleclient/blob/master/src/main/java/no/priv/bang/authservice/sampleclient/AuthserviceSampleClientShiroFilter.java#L73

The only thing the shiro.ini is used for is path to user/role/permission
mapping inside the webapps.

Configuration outside of path access, is a combination of configuration
by code in the activate methods of DS components, and OSGi service
injections into the same DS components (Realm and SessionDAO are
injected).

However, the class I use to start the configuration in the activate
metods, WebIniSecurityManagerFactory, is deprecated.

What should I use instead?


Thanks!


- Steinar


[GitHub] [shiro] asfgit commented on issue #156: SHIRO-711 - Deprecate JavaEnvironment

2019-06-27 Thread GitBox
asfgit commented on issue #156: SHIRO-711 - Deprecate JavaEnvironment
URL: https://github.com/apache/shiro/pull/156#issuecomment-506364456
 
 
   
   Refer to this link for build results (access rights to CI server needed): 
   https://builds.apache.org/job/Shiro-pr/130/
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [shiro] bdemers commented on a change in pull request #157: SHIRO-712 - Add BasicIniEnvironment

2019-06-27 Thread GitBox
bdemers commented on a change in pull request #157: SHIRO-712 - Add 
BasicIniEnvironment
URL: https://github.com/apache/shiro/pull/157#discussion_r298182745
 
 

 ##
 File path: core/src/main/java/org/apache/shiro/env/BasicIniEnvironment.java
 ##
 @@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.shiro.env;
+
+import org.apache.shiro.config.Ini;
+import org.apache.shiro.config.IniSecurityManagerFactory;
+import org.apache.shiro.mgt.SecurityManager;
+
+/**
+ * Basic usage:
+ * 
+ * Environment env = new BasicIniEnvironment("classpath:shiro.ini");
+ * SecurityManager securityManager = env.getSecurityManager();
+ * 
+ *
 
 Review comment:
   nit: add `@since 1.5`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [shiro] bdemers commented on issue #157: SHIRO-712 - Add BasicIniEnvironment

2019-06-27 Thread GitBox
bdemers commented on issue #157: SHIRO-712 - Add BasicIniEnvironment
URL: https://github.com/apache/shiro/pull/157#issuecomment-506350727
 
 
   Nice!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [shiro] bdemers commented on issue #156: SHIRO-711 - Deprecate JavaEnvironment

2019-06-27 Thread GitBox
bdemers commented on issue #156: SHIRO-711 - Deprecate JavaEnvironment
URL: https://github.com/apache/shiro/pull/156#issuecomment-506345743
 
 
   Thanks!! 
   
   Sorry one more nit, Can you add a `@deprecated` javadoc tag?  Maybe say 
something about will remove in the next major version? or this class is no 
longer used by Shiro 樂 ?
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [shiro] coheigea commented on issue #156: SHIRO-711 - Remove JavaEnvironment

2019-06-27 Thread GitBox
coheigea commented on issue #156: SHIRO-711 - Remove JavaEnvironment
URL: https://github.com/apache/shiro/pull/156#issuecomment-506341305
 
 
   @bdemers  Yes, done.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Updated] (SHIRO-711) Deprecate JavaEnvironment

2019-06-27 Thread Colm O hEigeartaigh (JIRA)


 [ 
https://issues.apache.org/jira/browse/SHIRO-711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Colm O hEigeartaigh updated SHIRO-711:
--
Summary: Deprecate JavaEnvironment  (was: Remove JavaEnvironment)

> Deprecate JavaEnvironment
> -
>
> Key: SHIRO-711
> URL: https://issues.apache.org/jira/browse/SHIRO-711
> Project: Shiro
>  Issue Type: Improvement
>Reporter: Colm O hEigeartaigh
>Priority: Major
> Fix For: 1.5.0
>
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> JavaEnvironment contains some static utility methods that refer to Java 
> versions that are no longer supported in the 1.5.0 release.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] [shiro] asfgit commented on issue #157: SHIRO-712 - Add BasicIniEnvironment

2019-06-27 Thread GitBox
asfgit commented on issue #157: SHIRO-712 - Add BasicIniEnvironment
URL: https://github.com/apache/shiro/pull/157#issuecomment-506290933
 
 
   
   Refer to this link for build results (access rights to CI server needed): 
   https://builds.apache.org/job/Shiro-pr/129/
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [shiro] coheigea opened a new pull request #157: SHIRO-712 - Add BasicIniEnvironment

2019-06-27 Thread GitBox
coheigea opened a new pull request #157: SHIRO-712 - Add BasicIniEnvironment
URL: https://github.com/apache/shiro/pull/157
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Created] (SHIRO-712) Add BasicIniEnvironment

2019-06-27 Thread Colm O hEigeartaigh (JIRA)
Colm O hEigeartaigh created SHIRO-712:
-

 Summary: Add BasicIniEnvironment
 Key: SHIRO-712
 URL: https://issues.apache.org/jira/browse/SHIRO-712
 Project: Shiro
  Issue Type: Improvement
Reporter: Colm O hEigeartaigh
 Fix For: 1.5.0


Add BasicIniEnvironment so that downstream projects don't have to rely on 
deprecated code. See:

[http://shiro-developer.582600.n2.nabble.com/Setting-up-Enviroment-td7579818.html]

[https://gist.github.com/bdemers/7acede56023b7f879a1103bc5373a2c5]

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] [shiro] asfgit commented on issue #156: SHIRO-711 - Remove JavaEnvironment

2019-06-27 Thread GitBox
asfgit commented on issue #156: SHIRO-711 - Remove JavaEnvironment
URL: https://github.com/apache/shiro/pull/156#issuecomment-506288273
 
 
   
   Refer to this link for build results (access rights to CI server needed): 
   https://builds.apache.org/job/Shiro-pr/128/
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Created] (SHIRO-711) Remove JavaEnvironment

2019-06-27 Thread Colm O hEigeartaigh (JIRA)
Colm O hEigeartaigh created SHIRO-711:
-

 Summary: Remove JavaEnvironment
 Key: SHIRO-711
 URL: https://issues.apache.org/jira/browse/SHIRO-711
 Project: Shiro
  Issue Type: Improvement
Reporter: Colm O hEigeartaigh
 Fix For: 1.5.0


JavaEnvironment contains some static utility methods that refer to Java 
versions that are no longer supported in the 1.5.0 release.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] [shiro] coheigea opened a new pull request #156: SHIRO-711 - Remove JavaEnvironment

2019-06-27 Thread GitBox
coheigea opened a new pull request #156: SHIRO-711 - Remove JavaEnvironment
URL: https://github.com/apache/shiro/pull/156
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services