shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Demers <>
Subject User-friendly framework shiro.ini
Date Mon, 19 Dec 2016 17:53:21 GMT
Hey All,

I started a thread with Jerome related to making Shiro easier to integrate
with frameworks/extensions (Specifically talking about some common bits
between the Stormpath and buji-pac4j)

It narrowed down to two things, which I think would benefit other
integrations as well.

1.) Allow for framework defaults in a WebEnvironment:

2.) Make specifying a custom Environment easier (i.e. no code/config)


Using buji-pac4j as an example: the framework defaults [#1] would be an INI
file that looks like this:
clients = org.pac4j.core.client.Clients
config = org.pac4j.core.config.Config
config.clients = $clients
pac4jRealm = io.buji.pac4j.realm.Pac4jRealm
pac4jSubjectFactory = io.buji.pac4j.subject.Pac4jSubjectFactory
securityManager.subjectFactory = $pac4jSubjectFactory

To load a custom WebEnvironment it requires setting a Servlet Init param.
This isn't the end of the world, but it isn't the most obvious thing either
(especially if you don't have a web.xml at all).

To get around this, I was playing around with the idea of using a
ServiceLoader, to detect which WebEnvirnoment to use.

PR-53 <> was a quick hack, but it
detects the WebEnvironment class in the following order:

1.) Servlet Init Paramer
2.) ServiceLoader (if exactly ONE instance is found)
3.) fall back to the default `IniWebEnvironment`

This allows for backwards compatibility as well as being able to extend
Shiro by dropping in an extra dependency.

I'm guessing a few of the other Shiro integrations would benefit from this
as well (Geode, Zeppelin).

Anyone have any thoughts or ideas on this topic?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message