You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Ludovic Garcia (JIRA)" <ji...@apache.org> on 2012/07/20 18:03:34 UTC

[jira] [Created] (SHIRO-378) PropertiesRealm able to reload Classpath properties files

Ludovic Garcia created SHIRO-378:
------------------------------------

             Summary: PropertiesRealm able to reload Classpath properties files
                 Key: SHIRO-378
                 URL: https://issues.apache.org/jira/browse/SHIRO-378
             Project: Shiro
          Issue Type: New Feature
          Components: Realms 
    Affects Versions: 1.2.0
         Environment: Windows 7 x64, Apache Tomcat 6.0.35, JDK 1.6.0_31 X64
            Reporter: Ludovic Garcia
            Priority: Minor


When deploying a project using shiro on Tomcat, users.properties file could be referenced as classpath files, with condition in PropertiesRealm.afterRoleCacheSet() at line 166, this is impossible.

if (this.resourcePath.startsWith(ResourceUtils.FILE_PREFIX) && scheduler != null) {
    startReloadThread();
}



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SHIRO-378) PropertiesRealm able to reload Classpath properties files

Posted by "Jared Bunting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHIRO-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13419968#comment-13419968 ] 

Jared Bunting commented on SHIRO-378:
-------------------------------------

My understanding - and this is also mentioned in the comments in that class, is that there's no real way to ask a URL or a classpath resource, "has this resource changed".  Do you have thoughts on getting around this limitation?
                
> PropertiesRealm able to reload Classpath properties files
> ---------------------------------------------------------
>
>                 Key: SHIRO-378
>                 URL: https://issues.apache.org/jira/browse/SHIRO-378
>             Project: Shiro
>          Issue Type: New Feature
>          Components: Realms 
>    Affects Versions: 1.2.0
>         Environment: Windows 7 x64, Apache Tomcat 6.0.35, JDK 1.6.0_31 X64
>            Reporter: Ludovic Garcia
>            Priority: Minor
>
> When deploying a project using shiro on Tomcat, users.properties file could be referenced as classpath files, with condition in PropertiesRealm.afterRoleCacheSet() at line 166, automatic file reloading is impossible.
> if (this.resourcePath.startsWith(ResourceUtils.FILE_PREFIX) && scheduler != null) {
>     startReloadThread();
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SHIRO-378) PropertiesRealm able to reload Classpath properties files

Posted by "Ludovic Garcia (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHIRO-378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ludovic Garcia updated SHIRO-378:
---------------------------------

    Description: 
When deploying a project using shiro on Tomcat, users.properties file could be referenced as classpath files, with condition in PropertiesRealm.afterRoleCacheSet() at line 166, automatic file reloading is impossible.

if (this.resourcePath.startsWith(ResourceUtils.FILE_PREFIX) && scheduler != null) {
    startReloadThread();
}



  was:
When deploying a project using shiro on Tomcat, users.properties file could be referenced as classpath files, with condition in PropertiesRealm.afterRoleCacheSet() at line 166, this is impossible.

if (this.resourcePath.startsWith(ResourceUtils.FILE_PREFIX) && scheduler != null) {
    startReloadThread();
}



    
> PropertiesRealm able to reload Classpath properties files
> ---------------------------------------------------------
>
>                 Key: SHIRO-378
>                 URL: https://issues.apache.org/jira/browse/SHIRO-378
>             Project: Shiro
>          Issue Type: New Feature
>          Components: Realms 
>    Affects Versions: 1.2.0
>         Environment: Windows 7 x64, Apache Tomcat 6.0.35, JDK 1.6.0_31 X64
>            Reporter: Ludovic Garcia
>            Priority: Minor
>
> When deploying a project using shiro on Tomcat, users.properties file could be referenced as classpath files, with condition in PropertiesRealm.afterRoleCacheSet() at line 166, automatic file reloading is impossible.
> if (this.resourcePath.startsWith(ResourceUtils.FILE_PREFIX) && scheduler != null) {
>     startReloadThread();
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SHIRO-378) PropertiesRealm able to reload Classpath properties files

Posted by "Ludovic Garcia (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHIRO-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13420265#comment-13420265 ] 

Ludovic Garcia commented on SHIRO-378:
--------------------------------------

I'm just Shiro for a short time, but in my case, the classpath resource is a properties file. I already did something to get around this limitation, but currently it's not proper.

Actually i extended  ClassUtils and added a methods, similar as getResourceAsStream() which returns class loader's getResource results instead of ClassLoaderAdvisor.getResourceAsStream().

Then, as for me the returned URL is pointing to a file, I instantiate a file using this path to my file.

I don't know if you consider this correct with shiro's way of reloading.

If you're interested in, I'll put the code (after proper refactoring).
 
                
> PropertiesRealm able to reload Classpath properties files
> ---------------------------------------------------------
>
>                 Key: SHIRO-378
>                 URL: https://issues.apache.org/jira/browse/SHIRO-378
>             Project: Shiro
>          Issue Type: New Feature
>          Components: Realms 
>    Affects Versions: 1.2.0
>         Environment: Windows 7 x64, Apache Tomcat 6.0.35, JDK 1.6.0_31 X64
>            Reporter: Ludovic Garcia
>            Priority: Minor
>
> When deploying a project using shiro on Tomcat, users.properties file could be referenced as classpath files, with condition in PropertiesRealm.afterRoleCacheSet() at line 166, automatic file reloading is impossible.
> if (this.resourcePath.startsWith(ResourceUtils.FILE_PREFIX) && scheduler != null) {
>     startReloadThread();
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SHIRO-378) PropertiesRealm able to reload Classpath properties files

Posted by "Ludovic Garcia (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SHIRO-378?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ludovic Garcia updated SHIRO-378:
---------------------------------

    Attachment: SHIRO-378-patch.txt

Here is the patch.
                
> PropertiesRealm able to reload Classpath properties files
> ---------------------------------------------------------
>
>                 Key: SHIRO-378
>                 URL: https://issues.apache.org/jira/browse/SHIRO-378
>             Project: Shiro
>          Issue Type: New Feature
>          Components: Realms 
>    Affects Versions: 1.2.0
>         Environment: Windows 7 x64, Apache Tomcat 6.0.35, JDK 1.6.0_31 X64
>            Reporter: Ludovic Garcia
>            Priority: Minor
>         Attachments: SHIRO-378-patch.txt
>
>
> When deploying a project using shiro on Tomcat, users.properties file could be referenced as classpath files, with condition in PropertiesRealm.afterRoleCacheSet() at line 166, automatic file reloading is impossible.
> if (this.resourcePath.startsWith(ResourceUtils.FILE_PREFIX) && scheduler != null) {
>     startReloadThread();
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SHIRO-378) PropertiesRealm able to reload Classpath properties files

Posted by "Ludovic Garcia (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHIRO-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13422979#comment-13422979 ] 

Ludovic Garcia commented on SHIRO-378:
--------------------------------------

This feature is also linked with bug I stated in the developper forum at : http://shiro-developer.582600.n2.nabble.com/TextConfigurationRealm-does-not-remove-user-Patch-included-td7577577.html
TextConfigurationRealm do not clear roles / users before loading, this do not cause problem for the first call of loadProperties() but when reloading propertiesFile in PropertiesRealm, deleted users and roles are kept in memory.
                
> PropertiesRealm able to reload Classpath properties files
> ---------------------------------------------------------
>
>                 Key: SHIRO-378
>                 URL: https://issues.apache.org/jira/browse/SHIRO-378
>             Project: Shiro
>          Issue Type: New Feature
>          Components: Realms 
>    Affects Versions: 1.2.0
>         Environment: Windows 7 x64, Apache Tomcat 6.0.35, JDK 1.6.0_31 X64
>            Reporter: Ludovic Garcia
>            Priority: Minor
>         Attachments: SHIRO-378-patch.txt
>
>
> When deploying a project using shiro on Tomcat, users.properties file could be referenced as classpath files, with condition in PropertiesRealm.afterRoleCacheSet() at line 166, automatic file reloading is impossible.
> if (this.resourcePath.startsWith(ResourceUtils.FILE_PREFIX) && scheduler != null) {
>     startReloadThread();
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Comment Edited] (SHIRO-378) PropertiesRealm able to reload Classpath properties files

Posted by "Ludovic Garcia (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SHIRO-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13420265#comment-13420265 ] 

Ludovic Garcia edited comment on SHIRO-378 at 7/22/12 6:27 PM:
---------------------------------------------------------------

I'm just using Shiro for a short time, but in my case, the classpath resource is a properties file. I already did something to get around this limitation, but currently it's not proper.

Actually i extended  ClassUtils and added a methods, similar as getResourceAsStream() which returns class loader's getResource results instead of ClassLoaderAdvisor.getResourceAsStream().

Then, as for me the returned URL is pointing to a file, I instantiate a file using this path to my file.

I don't know if you consider this correct with shiro's way of reloading.

If you're interested in, I'll put the code (after proper refactoring).
 
                
      was (Author: coxalass):
    I'm just Shiro for a short time, but in my case, the classpath resource is a properties file. I already did something to get around this limitation, but currently it's not proper.

Actually i extended  ClassUtils and added a methods, similar as getResourceAsStream() which returns class loader's getResource results instead of ClassLoaderAdvisor.getResourceAsStream().

Then, as for me the returned URL is pointing to a file, I instantiate a file using this path to my file.

I don't know if you consider this correct with shiro's way of reloading.

If you're interested in, I'll put the code (after proper refactoring).
 
                  
> PropertiesRealm able to reload Classpath properties files
> ---------------------------------------------------------
>
>                 Key: SHIRO-378
>                 URL: https://issues.apache.org/jira/browse/SHIRO-378
>             Project: Shiro
>          Issue Type: New Feature
>          Components: Realms 
>    Affects Versions: 1.2.0
>         Environment: Windows 7 x64, Apache Tomcat 6.0.35, JDK 1.6.0_31 X64
>            Reporter: Ludovic Garcia
>            Priority: Minor
>
> When deploying a project using shiro on Tomcat, users.properties file could be referenced as classpath files, with condition in PropertiesRealm.afterRoleCacheSet() at line 166, automatic file reloading is impossible.
> if (this.resourcePath.startsWith(ResourceUtils.FILE_PREFIX) && scheduler != null) {
>     startReloadThread();
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira