custom intercept development

Ryan Suarez ryan.suarez at sheridancollege.ca
Thu Oct 3 16:13:40 EDT 2019


Greetings,

I apologize in advance as I'm not a java developer. I'm trying to create a custom interceptor in the post-authentication flow by copying the existing attribute-release intercept. At this stage I'm just trying to print debugging logs. I can see the on-entry/"I'm in the second view" log from the flow, but I don't see the "Hello World" log from the class file. Any pointers?

/opt/shibboleth-idp/flows/intercept/myIntercept/myIntercept-flow.xml:

    <view-state id="secondView" view="#{flowRequestContext.activeFlow.id}-secondView">
        <on-entry>
            <evaluate expression="T(org.slf4j.LoggerFactory).getLogger('net.shibboleth.idp').info('Im in the second view')" />
        </on-entry>
        <on-render>
            <evaluate expression="environment" result="viewScope.environment" />
            <evaluate expression="T(net.shibboleth.utilities.java.support.codec.HTMLEncoder)" result="viewScope.encoder" />
            <evaluate expression="flowRequestContext.getExternalContext().getNativeRequest()" result="viewScope.request" />
            <evaluate expression="flowRequestContext.getExternalContext().getNativeResponse()" result="viewScope.response" />
            <evaluate expression="MyIntercept" />
        </on-render>
    </view-state>

/opt/shibboleth-idp/flows/intercept/myIntercept/myIntercept-beans.xml:

    <bean id="MyIntercept"
        class="net.myOrg.MyIntercept" scope="prototype" />

MyIntercept.java:

package net.myOrg;

import net.shibboleth.idp.profile.context.ProfileInterceptorContext;
import org.opensaml.profile.context.ProfileRequestContext;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class MyIntercept {

    /** Class logger. */
    Logger log = LoggerFactory.getLogger("net.shibboleth.idp");

    protected void doExecute(final ProfileRequestContext profileRequestContext,
            final ProfileInterceptorContext interceptorContext) {

        log.info("Hello World");

    }
}

# javac -cp "./jars/*" MyIntercept.java
# mv MyIntercept.class net/myOrg/
# jar -cvf myOrg-0.3.jar net
added manifest
adding: net/(in = 0) (out= 0)(stored 0%)
adding: net/myOrg/(in = 0) (out= 0)(stored 0%)
adding: net/myOrg/MyIntercept.class(in = 680) (out= 433)(deflated 36%)

# cp myOrg-0.3.jar /opt/shibboleth-idp/edit-webapp/WEB-INF/lib/
# /opt/shibboleth-idp/bin/build.sh

regards,
Ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20191003/3ca3c484/attachment.html>


More information about the users mailing list