Skip to content

Commit

Permalink
Switch from programmatic services to DS annotations (Issue #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesse-gallagher committed Aug 18, 2019
1 parent 9344cfd commit 1fb41c7
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 82 deletions.
Expand Up @@ -11,5 +11,8 @@ Import-Package: com.ibm.websphere.security;version="1.0.0",
com.ibm.wsspi.security.tai;version="1.0.0", com.ibm.wsspi.security.tai;version="1.0.0",
javax.servlet.http, javax.servlet.http,
org.osgi.framework;version="1.5.0", org.osgi.framework;version="1.5.0",
org.osgi.service.cm;version="1.5.0" org.osgi.service.cm;version="1.5.0",
Bundle-Activator: org.openntf.openliberty.wlp.userregistry.Activator 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 output.. = target/classes
bin.includes = META-INF/,\ bin.includes = META-INF/,\
. .,\
OSGI-INF/
source.. = src source.. = src

This file was deleted.

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


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

import com.ibm.websphere.security.WebTrustAssociationException; import com.ibm.websphere.security.WebTrustAssociationException;
import com.ibm.websphere.security.WebTrustAssociationFailedException; import com.ibm.websphere.security.WebTrustAssociationFailedException;
import com.ibm.wsspi.security.tai.TAIResult; import com.ibm.wsspi.security.tai.TAIResult;
import com.ibm.wsspi.security.tai.TrustAssociationInterceptor; 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 { public class DominoTAI implements TrustAssociationInterceptor {
private static final Logger log = Logger.getLogger(DominoTAI.class.getPackage().getName()); private static final Logger log = Logger.getLogger(DominoTAI.class.getPackage().getName());
static { static {
log.setLevel(Level.FINER); 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 String ENV_PROXY = System.getenv("Domino_HTTP");
private static final boolean enabled = ENV_PROXY != null && !ENV_PROXY.isEmpty(); private static final boolean enabled = ENV_PROXY != null && !ENV_PROXY.isEmpty();


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


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


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


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

import com.ibm.websphere.security.CertificateMapFailedException; import com.ibm.websphere.security.CertificateMapFailedException;
import com.ibm.websphere.security.CertificateMapNotSupportedException; import com.ibm.websphere.security.CertificateMapNotSupportedException;
import com.ibm.websphere.security.CustomRegistryException; import com.ibm.websphere.security.CustomRegistryException;
Expand All @@ -45,16 +47,20 @@
import com.ibm.websphere.security.cred.WSCredential; 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 * @author Jesse Gallagher
* @since 1.18004.0 * @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> * @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 { public class DominoUserRegistry implements UserRegistry {
private static final Logger log = Logger.getLogger(DominoUserRegistry.class.getPackage().getName()); private static final Logger log = Logger.getLogger(DominoUserRegistry.class.getPackage().getName());
static { static {
log.setLevel(Level.FINER); log.setLevel(Level.FINER);
} }
public static final String CONFIG_PID = "dominoUserRegistry";


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

0 comments on commit 1fb41c7

Please sign in to comment.