Re: Possible to programmatically open URLs
Have you actually tried it? It’s unusual but should work if I understand your example correctly > On Mar 4, 2024, at 2:08 PM, Steinar Bang wrote: > > If I have a shiro.ini like so: > > [main] > authc = org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter > shiro.loginUrl = /login > shiro.unauthorizedUrl = /unauthorized > > [users] > > [urls] > / = anon > /api/** = anon > /album/** = authc > > Ie. /album/ requires a login. > > Is it then possible to programmatically add anon access to children of > /album/? > > I.e. can I programmatically do the equivalent of the following? > > [urls] > / = anon > /api/** = anon > /album/picture1 = anon > /album/picture2 = anon > /album/** = authc > > I have tried to google but I haven't found any examples of how to do > it. It should be possible since e.g. the shiro-jaxrs code does > something similar? > > Thanks! > > > - Steinar >
Re: Possible to programmatically open URLs
> Lenny Primak : > Have you actually tried it? It’s unusual but should work if I understand > your example correctly Oh the shiro.ini example as shown will work, no problem. But I don't want to set the access of /album/picture1 and /album/picture2 in the shiro.ini What I want to do is to have a shiro.ini like so: [urls] / = anon /api/** = anon /album/** = authc And then I would like to *programatically* set anon access on /album/picture1 and /album/picture2.
Re: Possible to programmatically open URLs
Hi, What I think you are asking is hybrid configuration. You would have to override WebEnvironment class. I believe this is well documented already > On Mar 4, 2024, at 4:05 PM, Steinar Bang wrote: > > >> >> Lenny Primak : > >> Have you actually tried it? It’s unusual but should work if I understand >> your example correctly > > Oh the shiro.ini example as shown will work, no problem. > > But I don't want to set the access of /album/picture1 and > /album/picture2 in the shiro.ini > > What I want to do is to have a shiro.ini like so: > > [urls] > / = anon > /api/** = anon > /album/** = authc > > And then I would like to *programatically* set anon access on > /album/picture1 and /album/picture2. >
Re: Possible to programmatically open URLs
> Lenny Primak : > What I think you are asking is hybrid configuration. You would have to > override WebEnvironment class. I believe this is well documented already Thanks! So I tried googling "override webenvironment hybrid configuration" but that didn't come up with anything useful. Googling "override webenvironment shiro" got me here: https://shiro.apache.org/web.html But that page didn't make me any wiser.. I think that what I want to do is to programmatically adding filters linked to paths. But what fiters to add and where to add them, is still a mystery.