GCF Connector to dotnet app

has anyone implemented or written a CPIP connector to a dotnet web application? i have used both cookies with pickup.html and pickup.response methods, but i haven't got it to work.

below here are my properites and xml files using the cookies with pickup.html method. assuming that i have followed all the steps correctly, could somebody point out what i'm doing wrong with my configuration files?

# gtwy.properties

gtwy.externalSystemName    = gtwy
gtwy.pickup.remoteurl      = https://server.edu/lumgtwy/pickup.html

gtwy.externalSystemURL     = https://server.edu/lumgtwy
gtwy.operations            = /opt/luminis/webapps/cpipconnector/WEB-INF/config/gtwy.xml

gtwy.sso.operations.class                            = com.campuspipeline.sso.authenticator.SSOOperations
gtwy.urlBase                                         = ${cpipconnector.urlBase}/${gtwy.externalSystemName}

gtwy.cpipconnector.getconfig.createonlogin           = 0

gtwy.cpipconnector.getconfig.authenticate            = ${gtwy.urlBase}/Authenticate
gtwy.cpipconnector.getconfig.authenticateOIDlist     = 1.3.6.1.4.1.4409.1.1.4.2
gtwy.cpipconnector.getconfig.deauthenticate          = ${gtwy.urlBase}/Deauthenticate
gtwy.cpipconnector.getconfig.deauthenticateOIDlist   = 1.3.6.1.4.1.4409.1.1.6.1
gtwy.cpipconnector.getconfig.lastactive              = ${gtwy.urlBase}/LastActive
gtwy.cpipconnector.getconfig.lastactiveOIDlist       = 1.3.6.1.4.1.4409.1.1.5.1

gtwy.cpipconnector.getconfig.sessionPlaceHolder      = sessionPlaceHolder
gtwy.cpipconnector.getconfig.sendcpsession           = true
gtwy.cpipconnector.getconfig.sendtimeout             = false
gtwy.cpipconnector.getconfig.desturl_parmname        = destURL
gtwy.cpipconnector.getconfig.sendlogin               = true
gtwy.cpipconnector.getconfig.useSISCredentials       = false
gtwy.cpipconnector.getconfig.usePDSCredentials       = true

gtwy.pickup.destURLParameter                         = url

# gtwy.xml

<operations>
    <authenticate>
        <CLIENT>
            <SESSION a:server="${properties.externalSystemURL}" >

		<GET a:url="/lumgtwy/login.aspx" a:query="" a:redirects="no" />

		<LOADFORM a:symbol="MainLogin" a:tagname="" />
		<SET a:symbol="MainLogin.txtUsername" a:value="${_CPUSERNAME}" />
		<SET a:symbol="MainLogin.txtPassword" a:value="${_PASSWORD}" />
		<SET a:symbol="MainLogin.__VIEWSTATE" a:value="/wEPDwUKMTEyMTc3MTQwNmRkoOErJtErtU8L3bdcEhLqrhn1sDZ8=" />
		<POST a:url="/lumgtwy/login.aspx" a:query="" a:redirects="yes" >
		    <PARAM a:list="MainLogin" />
		</POST>

		<SEARCH a:symbol="success" a:source="${_RESPONSE}" a:value="${_VALUE}" >
		    <EXISTS a:string="For security reasons, always remember" a:found="TRUE" a:notfound="FALSE" />
		</SEARCH>

                <RESULT a:value="${success}" />
            </SESSION>
        </CLIENT>
    </authenticate>
    <deauthenticate>
        <CLIENT>
            <SESSION a:server="${properties.externalSystemURL}" >
                <RESULT a:value="TRUE" />
            </SESSION>
        </CLIENT>
    </deauthenticate>
    <lastActive>
        <CLIENT>
            <SESSION a:server="${properties.externalSystemURL}" >
                <RESULT a:value="FALSE" />
            </SESSION>
        </CLIENT>
    </lastActive>
    <checkstate>
        <CLIENT>
            <SESSION a:server="${properties.externalSystemURL}" >
                <RESULT a:value="FALSE" />
            </SESSION>
        </CLIENT>
    </checkstate>
</operations>

0
No votes yet

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

For custom dot net app

Here's how I made it work using the properties and xml files above:

1) Create login.htm

<form method="post" action="login.aspx">
Username:  <input name="txtUsername" type="text" id="txtUsername" style="width:150px;" />
Password: <input name="txtPassword" type="password" id="txtPassword" style="width:150px;" />
<input type="submit" name="btnLogin" value="Login" class="button" /> </form>

2) Inside the login.aspx.cs (authenticating agains Active Directory)

    protected void Page_Load(object sender, EventArgs e)
    {
        String username = Request.Form["txtUsername"].ToString().Trim();
        String password = Request.Form["txtPassword"].ToString().Trim();

            if (!isAuthenticated(username, password))
            {
                Response.Redirect("authfailed.htm", false);
                return;
            }
            else
            {
                Response.Redirect("default.aspx", false);
             }

    }

    private bool isAuthenticated(String username, String password)
    {
        bool isAuthOk = false;
        String path = "LDAP://yourdomain.edu";
        String connStr = "urdomain-if-required\\" + username;
        DirectoryEntry entry = new DirectoryEntry(path, connStr, password);

        try
        {
            Object obj = entry.NativeObject;
            DirectorySearcher search = new DirectorySearcher(entry);
            search.Filter = string.Format("(SAMAccountName={0})", username);
            search.PropertiesToLoad.Add("cn");
            SearchResult result = search.FindOne();
            if (result != null)
                isAuthOk = true;
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return isAuthOk;
    }