Here's my code:
const express = require('express');
const app = express();
const CAS = require('cas');
// CAS configuration
const cas = new CAS({
base_url: 'https://shib.idm.umd.edu/shibboleth-idp/profile/cas',
version: 3.0,
service: 'login.umd.edu/cas'
});
app.use((req, res, next) => {
cas.authenticate(req, res, (err, status, username, extended) => {
if (err) {
// Handle the error
console.log("error:", err);
res.send({ error: 'CAS Authentication Error' });
} else {
// If authentication is successful, add CAS information to the session
req.session.cas = {
user: username,
attributes: extended.attributes,
};
next();
}
});
});
// Define a route for the home page
app.get('/', (req, res) => {
res.send(Hello, ${req.session.cas && req.session.cas.user}! <a href="/logout">Logout</a>
);
});
// Define a route for logout
app.get('/logout', cas.logout);
// Start the server
const port = 4000;
const ip = 'my_local_ip_address';
app.listen(port, ip, () => {
console.log(Server running on http://${ip}:${port}
);
});
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.
Top comments (0)