Fournier, Danny G
2013-12-05 20:23:00 UTC
I've started from the spnego-auth service, copied it and refactored it
to reflect the new name of the class (ShibbolethAuthenticationFactory
and ShibbolethAuthenticationScheme). It now resides in shibboleth-auth.
The issue is that it doesn't seem to be loading its configuration thus
not adding itself to Daisy. When I output the length of schemeConfs, I
get 0.
Here is myconfig.xml:
<target path="/daisy/repository/authentication/shibboleth">
<configuration>
<scheme name="shibboleth1" description="Test Shibboleth config">
<cache enabled="false" maxCacheSize="3000"
maxCacheDuration="1800000"/>
</scheme>
</configuration>
</target>
Here is my ShibbolethAuthenticationFactory.java file. Notice the
System.out line where I output the length of schemeConfs in the
configure method:
public class ShibbolethAuthenticationFactory {
private PluginRegistry pluginRegistry;
private Map<String, AuthenticationScheme> schemes = new
HashMap<String, AuthenticationScheme>();
public ShibbolethAuthenticationFactory(Configuration configuration,
PluginRegistry pluginRegistry) throws Exception {
this.pluginRegistry = pluginRegistry;
this.configure(configuration);
this.registerSchemes();
}
@PreDestroy
public void destroy() {
unregisterSchemes();
}
private void registerSchemes() throws Exception {
for (Map.Entry<String, AuthenticationScheme> entry :
schemes.entrySet()) {
pluginRegistry.addPlugin(AuthenticationScheme.class,
entry.getKey(), entry.getValue());
}
}
private void unregisterSchemes() {
for (Map.Entry<String, AuthenticationScheme> entry :
schemes.entrySet()) {
pluginRegistry.removePlugin(AuthenticationScheme.class,
entry.getKey(), entry.getValue());
}
}
private void configure(Configuration configuration) throws
ConfigurationException {
Configuration[] schemeConfs =
configuration.getChildren("scheme");
System.out.println("Number of schemes while configuring
ShibbolethAuthenticationFactory:"+schemeConfs.length);
for (Configuration schemeConf : schemeConfs) {
String name = schemeConf.getAttribute("name");
String description = schemeConf.getAttribute("description");
UserCreator userCreator =
UserCreatorFactory.createUser(schemeConf, name);
AuthenticationScheme scheme = new
ShibbolethAuthenticationScheme(name, description, userCreator);
Configuration cacheConf = schemeConf.getChild("cache");
if (cacheConf.getAttributeAsBoolean("enabled")) {
int maxCacheSize =
cacheConf.getAttributeAsInteger("maxCacheSize", 3000);
long maxCacheDuration =
cacheConf.getAttributeAsLong("maxCacheDuration", 30 * 60 * 1000); //
default: half an hour
scheme = new CachingAuthenticationScheme(scheme,
maxCacheDuration, maxCacheSize);
}
if (schemes.containsKey(name))
throw new ConfigurationException("Duplicate
authentication scheme name: " + name);
schemes.put(name, scheme);
}
}
}
At the moment, when I start my repository, here is the output of the
console:
[snip]
[main] INFO org.outerj.daisy.runtime.info - Starting container
shibboleth -
/home/me/.m2/repository/daisy/daisy-auth-shibboleth/2.4.2/daisy-auth-shi
bboleth-2.4.2.jar
Number of schemes while configuring ShibbolethAuthenticationFactory:0
[snip]
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cocoondev.org/pipermail/daisy/attachments/20131205/f7e58305/attachment.htm
to reflect the new name of the class (ShibbolethAuthenticationFactory
and ShibbolethAuthenticationScheme). It now resides in shibboleth-auth.
The issue is that it doesn't seem to be loading its configuration thus
not adding itself to Daisy. When I output the length of schemeConfs, I
get 0.
Here is myconfig.xml:
<target path="/daisy/repository/authentication/shibboleth">
<configuration>
<scheme name="shibboleth1" description="Test Shibboleth config">
<cache enabled="false" maxCacheSize="3000"
maxCacheDuration="1800000"/>
</scheme>
</configuration>
</target>
Here is my ShibbolethAuthenticationFactory.java file. Notice the
System.out line where I output the length of schemeConfs in the
configure method:
public class ShibbolethAuthenticationFactory {
private PluginRegistry pluginRegistry;
private Map<String, AuthenticationScheme> schemes = new
HashMap<String, AuthenticationScheme>();
public ShibbolethAuthenticationFactory(Configuration configuration,
PluginRegistry pluginRegistry) throws Exception {
this.pluginRegistry = pluginRegistry;
this.configure(configuration);
this.registerSchemes();
}
@PreDestroy
public void destroy() {
unregisterSchemes();
}
private void registerSchemes() throws Exception {
for (Map.Entry<String, AuthenticationScheme> entry :
schemes.entrySet()) {
pluginRegistry.addPlugin(AuthenticationScheme.class,
entry.getKey(), entry.getValue());
}
}
private void unregisterSchemes() {
for (Map.Entry<String, AuthenticationScheme> entry :
schemes.entrySet()) {
pluginRegistry.removePlugin(AuthenticationScheme.class,
entry.getKey(), entry.getValue());
}
}
private void configure(Configuration configuration) throws
ConfigurationException {
Configuration[] schemeConfs =
configuration.getChildren("scheme");
System.out.println("Number of schemes while configuring
ShibbolethAuthenticationFactory:"+schemeConfs.length);
for (Configuration schemeConf : schemeConfs) {
String name = schemeConf.getAttribute("name");
String description = schemeConf.getAttribute("description");
UserCreator userCreator =
UserCreatorFactory.createUser(schemeConf, name);
AuthenticationScheme scheme = new
ShibbolethAuthenticationScheme(name, description, userCreator);
Configuration cacheConf = schemeConf.getChild("cache");
if (cacheConf.getAttributeAsBoolean("enabled")) {
int maxCacheSize =
cacheConf.getAttributeAsInteger("maxCacheSize", 3000);
long maxCacheDuration =
cacheConf.getAttributeAsLong("maxCacheDuration", 30 * 60 * 1000); //
default: half an hour
scheme = new CachingAuthenticationScheme(scheme,
maxCacheDuration, maxCacheSize);
}
if (schemes.containsKey(name))
throw new ConfigurationException("Duplicate
authentication scheme name: " + name);
schemes.put(name, scheme);
}
}
}
At the moment, when I start my repository, here is the output of the
console:
[snip]
[main] INFO org.outerj.daisy.runtime.info - Starting container
shibboleth -
/home/me/.m2/repository/daisy/daisy-auth-shibboleth/2.4.2/daisy-auth-shi
bboleth-2.4.2.jar
Number of schemes while configuring ShibbolethAuthenticationFactory:0
[snip]
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cocoondev.org/pipermail/daisy/attachments/20131205/f7e58305/attachment.htm