Skip to content
Permalink
Browse files

Switch from programmatic services to DS annotations (Issue #17)

  • Loading branch information...
jesse-gallagher committed Aug 18, 2019
1 parent 9344cfd commit 1fb41c77c84a75d850d76d82a6093c01a7addd42
@@ -11,5 +11,8 @@ Import-Package: com.ibm.websphere.security;version="1.0.0",
com.ibm.wsspi.security.tai;version="1.0.0",
javax.servlet.http,
org.osgi.framework;version="1.5.0",
org.osgi.service.cm;version="1.5.0"
Bundle-Activator: org.openntf.openliberty.wlp.userregistry.Activator
org.osgi.service.cm;version="1.5.0",
org.osgi.service.component.annotations;version="1.2.0";resolution:=optional
Service-Component: OSGI-INF/org.openntf.openliberty.wlp.userregistry.DominoUserRegistry.xml,
OSGI-INF/org.openntf.openliberty.wlp.userregistry.DominoTAI.xml
Bundle-ActivationPolicy: lazy
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0" configuration-pid="org.openntf.openliberty.wlp.userregistry.DominoTAI" name="org.openntf.openliberty.wlp.userregistry.DominoTAI">
<property name="invokeBeforeSSO" type="Boolean" value="true"/>
<property name="id" value="org.openntf.openliberty.wlp.userregistry.DominoTAI"/>
<service>
<provide interface="com.ibm.wsspi.security.tai.TrustAssociationInterceptor"/>
</service>
<implementation class="org.openntf.openliberty.wlp.userregistry.DominoTAI"/>
</scr:component>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0" configuration-pid="dominoUserRegistry" name="org.openntf.openliberty.wlp.userregistry.DominoUserRegistry">
<service>
<provide interface="com.ibm.websphere.security.UserRegistry"/>
</service>
<implementation class="org.openntf.openliberty.wlp.userregistry.DominoUserRegistry"/>
</scr:component>
@@ -1,4 +1,5 @@
output.. = target/classes
bin.includes = META-INF/,\
.
.,\
OSGI-INF/
source.. = src

This file was deleted.

@@ -31,17 +31,35 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.osgi.service.component.annotations.Component;

import com.ibm.websphere.security.WebTrustAssociationException;
import com.ibm.websphere.security.WebTrustAssociationFailedException;
import com.ibm.wsspi.security.tai.TAIResult;
import com.ibm.wsspi.security.tai.TrustAssociationInterceptor;

/**
* This class provides one-way single-sign-on based on an active Domino session with
* the backing server.
*
* @author Jesse Gallagher
* @since 1.18004.0
*/
@Component(
service=TrustAssociationInterceptor.class,
configurationPid=DominoTAI.CONFIG_PID,
property={
"invokeBeforeSSO:Boolean=true",
"id=" + DominoTAI.CONFIG_PID
}
)
public class DominoTAI implements TrustAssociationInterceptor {
private static final Logger log = Logger.getLogger(DominoTAI.class.getPackage().getName());
static {
log.setLevel(Level.FINER);
}

public static final String CONFIG_PID = "org.openntf.openliberty.wlp.userregistry.DominoTAI";
private static final String ENV_PROXY = System.getenv("Domino_HTTP");
private static final boolean enabled = ENV_PROXY != null && !ENV_PROXY.isEmpty();

@@ -66,7 +84,7 @@ public void cleanup() {

@Override
public String getType() {
return getClass().getName();
return CONFIG_PID;
}

@Override
@@ -34,6 +34,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import org.osgi.service.component.annotations.Component;

import com.ibm.websphere.security.CertificateMapFailedException;
import com.ibm.websphere.security.CertificateMapNotSupportedException;
import com.ibm.websphere.security.CustomRegistryException;
@@ -45,16 +47,20 @@
import com.ibm.websphere.security.cred.WSCredential;

/**
* This class provides a Liberty {@link UserRegistry} based on the effective directory
* of the backing Domino server.
*
* @author Jesse Gallagher
* @since 1.18004.0
* @see <a href="https://www.ibm.com/support/knowledgecenter/SSAW57_9.0.0/com.ibm.websphere.nd.multiplatform.doc/ae/tsec_users.html?view=kc">Developing the UserRegistry interface for using custom registries</a>
*/
@Component(service=UserRegistry.class, configurationPid=DominoUserRegistry.CONFIG_PID)
public class DominoUserRegistry implements UserRegistry {
private static final Logger log = Logger.getLogger(DominoUserRegistry.class.getPackage().getName());
static {
log.setLevel(Level.FINER);
}
public static final String CONFIG_PID = "dominoUserRegistry";

public DominoUserRegistry() {
if(log.isLoggable(Level.FINER)) {

0 comments on commit 1fb41c7

Please sign in to comment.
You can’t perform that action at this time.