<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ikatyal2110</title>
    <description>The latest articles on DEV Community by ikatyal2110 (@ikatyal2110).</description>
    <link>https://dev.to/ikatyal2110</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1358398%2F72d13a67-99d7-4f53-9224-0abb0b4da567.png</url>
      <title>DEV Community: ikatyal2110</title>
      <link>https://dev.to/ikatyal2110</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ikatyal2110"/>
    <language>en</language>
    <item>
      <title>Node js CAS log in application</title>
      <dc:creator>ikatyal2110</dc:creator>
      <pubDate>Sat, 16 Mar 2024 23:27:37 +0000</pubDate>
      <link>https://dev.to/ikatyal2110/node-js-cas-log-in-application-opo</link>
      <guid>https://dev.to/ikatyal2110/node-js-cas-log-in-application-opo</guid>
      <description>&lt;p&gt;Here's my code:&lt;/p&gt;

&lt;p&gt;const express = require('express');&lt;br&gt;
const app = express();&lt;br&gt;
const CAS = require('cas');&lt;/p&gt;

&lt;p&gt;// CAS configuration&lt;br&gt;
const cas = new CAS({&lt;br&gt;
  base_url: '&lt;a href="https://shib.idm.umd.edu/shibboleth-idp/profile/cas"&gt;https://shib.idm.umd.edu/shibboleth-idp/profile/cas&lt;/a&gt;',&lt;br&gt;
  version: 3.0,&lt;br&gt;
  service: 'login.umd.edu/cas'&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;app.use((req, res, next) =&amp;gt; {&lt;br&gt;
  cas.authenticate(req, res, (err, status, username, extended) =&amp;gt; {&lt;br&gt;
    if (err) {&lt;br&gt;
      // Handle the error&lt;br&gt;
      console.log("error:", err);&lt;br&gt;
      res.send({ error: 'CAS Authentication Error' });&lt;br&gt;
    } else {&lt;br&gt;
      // If authentication is successful, add CAS information to the session&lt;br&gt;
      req.session.cas = {&lt;br&gt;
        user: username,&lt;br&gt;
        attributes: extended.attributes,&lt;br&gt;
      };&lt;br&gt;
      next();&lt;br&gt;
    }&lt;br&gt;
  });&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;// Define a route for the home page&lt;br&gt;
app.get('/', (req, res) =&amp;gt; {&lt;br&gt;
  res.send(&lt;code&gt;Hello, ${req.session.cas &amp;amp;&amp;amp; req.session.cas.user}! &amp;lt;a href="/logout"&amp;gt;Logout&amp;lt;/a&amp;gt;&lt;/code&gt;);&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;// Define a route for logout&lt;br&gt;
app.get('/logout', cas.logout);&lt;/p&gt;

&lt;p&gt;// Start the server&lt;br&gt;
const port = 4000;&lt;br&gt;
const ip = 'my_local_ip_address';&lt;br&gt;
app.listen(port, ip, () =&amp;gt; {&lt;br&gt;
  console.log(&lt;code&gt;Server running on http://${ip}:${port}&lt;/code&gt;);&lt;br&gt;
});&lt;/p&gt;

&lt;p&gt;Im not sure how to fix this, or what the problem even is, but to reiterate the issue, I can enter my username and password, and it sends my info for validation, but the response gets dropped. Any advice/suggestions would be helpful. &lt;/p&gt;

</description>
      <category>node</category>
      <category>cas</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
