This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd "> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>{your groupId here}</groupId> | |
<artifactId>local-cas</artifactId> | |
<packaging>war</packaging> | |
<version>1.0-SNAPSHOT</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example taken from https://github.com/ciaranj/connect-auth/issues/45 | |
var fbId= "xxxxxxxxxxxxx"; | |
var fbSecret= "xxxxxxxxxxxxxx"; | |
var fbCallbackAddress= "http://localhost:3000/auth/facebook_callback" | |
var cookieSecret = "node"; // enter a random hash for security | |
var express= require('express'); | |
var auth = require('connect-auth') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.error(function( err, req, res, next ){ | |
console.log(err); | |
if( ! ( err instanceof SoftError ) ) { | |
console.log(err.stack); | |
res.render('errors.ejs', {error: err.message || err.name }); | |
} | |
}); | |
app.all('/errr', function( req, res ){ | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var loadCommon = function( req, res, next ) { | |
var user = req.getAuthDetails().user; | |
req.age = req.session.age || 0; | |
req.user = (user === undefined ? false : (user.username || user.email || false)); | |
if(!config.devmode) { | |
req.authprovider = req.session.authprovider; //LIVE | |
} else { | |
req.user = "removeme"; // DEV MODE | |
req.authprovider = 'twitter'; //DEV MODE | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test Gist |