Hello guys! I'm trying to put authentication through azure as shown here in the documentation:
nodered.org/docs/user-guide/runtime/securing-node-red#oauthopenid-based-authentication
Based on these examples:
My adminAuth
object is shown below:
adminAuth: {
type: "strategy",
strategy: {
name: "azuread-openidconnect",
label: "Sign in with Azure AD",
icon: "fa-windows",
strategy: require("passport-azure-ad").OIDCStrategy,
options: {
identityMetadata: `https://login.microsoftonline.com/${process.env.MICROSOFT_AUTH_TENANT_ID}/v2.0/.well-known/openid-configuration`,
clientID: process.env.MICROSOFT_AUTH_CLIENT_ID,
clientSecret: process.env.MICROSOFT_AUTH_CLIENT_SECRET,
responseType: "code",
responseMode: "query",
redirectUrl: "https://localhost:1880/auth/strategy/callback",
allowHttpForRedirectUrl: true,
issuer: `https://login.microsoftonline.com/${process.env.MICROSOFT_AUTH_TENANT_ID}/v2.0`,
scope: ["openid", "profile"],
verify: function (token, tokenSecret, profile, done) {
profile.username = profile.displayName; // use display name as username
done(null, profile);
},
},
},
users: function (user) {
return Promise.resolve({ username: user, permissions: "*" });
},
},
I'm trying to create a custom Docker image that uses this settings file, when I start node-red I get the following terminal output:
nodered-custom |
nodered-custom | > node-red-custom@0.0.1 start /usr/src/node-red
nodered-custom | > node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS --userDir=/data
nodered-custom |
nodered-custom | Error loading settings file: /data/settings.js
nodered-custom |
nodered-custom | โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
nodered-custom | โ npm update check failed โ
nodered-custom | โ Try running with sudo or get access โ
nodered-custom | โ to the local update config store via โ
nodered-custom | โ sudo chown -R $USER:$(id -gn $USER) /usr/src/node-red/.config โ
nodered-custom | โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
nodered-dblab exited with code 0
When I use a configuration file as shown below:
adminAuth: require("./user-authentication"),
And following the example of the documentation, it works
nodered.org/docs/user-guide/runtime/securing-node-red#custom-user-authentication
It also works when I use an username and password based authentication
nodered.org/docs/user-guide/runtime/securing-node-red#usernamepassword-based-authentication
Using the twitter example found in docs, it doesn't work and I get the same errors bellow
adminAuth: {
type:"strategy",
strategy: {
name: "twitter",
label: 'Sign in with Twitter',
icon:"fa-twitter",
strategy: require("passport-twitter").Strategy,
options: {
consumerKey: TWITTER_APP_CONSUMER_KEY,
consumerSecret: TWITTER_APP_CONSUMER_SECRET,
callbackURL: "http://example.com/auth/strategy/callback",
verify: function(token, tokenSecret, profile, done) {
done(null, profile);
}
},
},
users: [
{ username: "knolleary",permissions: ["*"]}
]
}
Can anyone help me try to solve this problem to correctly configure authentication?