Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
appcelerator-saml
Advanced tools
Appcelerator SAML provides SAML 2.0 Autehntication for Appcelerator Arrow driven applications. The module is tested and works with the following IDps : Onelogin, Okta, Shibboleth, SimpleSAMLphp.
npm install appcelerator-saml
``
./conf/default.js
APIKeyAuthType: 'plugin', // Modify the default 'APIKeyAuthType', and set it to 'plugin'
APIKeyAuthPlugin: 'appcelerator-saml'
Typescript files and the tsconfig.json file, are not included with the node module. If you want to use the typescript files, clone the repo.
Copy conf/example.config.js
to you project's configuration folder, and rename the file to :
appc.saml.default.js
.
Set the privateCertLocation and certLocation if you are going to use private key and certificate, to authenticate against the server.
//Application login Url
loginUrl: '/saml/login',
//The url, where data sent from the IDp will be handled
callbackUrl : '/saml/response/callback',
//optional : Location of private key file (relative to project root)
privateCertLocation : './pk/login.axway.com.pem',
//optional : Location of certificat file (relative to project root)
certLocation : './pk/login.axway.com.crt',
// Routes that don't require authentication
allowedPaths : ['/saml/response/callback', '/saml/login', '/successed'],
//resultObject : is the Object structure, that you application requires
//the object member values are the keys of the Object received from the IDp
resultObject : {
firstName : 'firstname',
lastName : 'lastname',
email : 'email',
username : 'username',
language : 'preferredLanguage'
},
//passport-saml configuration object
passport: {
strategy: 'saml',
saml: {
//Should be an absolute path
callbackUrl: 'https://localhost:8080/response/callback',
entryPoint: 'https://idp.com/saml2/idp/SSOService.php',
issuer: 'cloud:passport:saml',
authnContext: 'http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/windows',
logoutCallbackUrl: 'https://localhost:8080/saml/logout'
}
}
{
identifier : 1001,
firsNameOfUser : 'Name',
surName : 'Othername',
authenticationName : 'authname'
}
And the object structure that you want is :
{
id : 1001,
firstName : 'Name',
lastName : 'Othername',
username : 'authname'
}
So the resultObject should look like this :
{
id : 'identifier',
firstName : 'firsNameOfUser',
lastName : 'surName',
username : 'authenticationName'
}
For more infromation on the passport object, check the documentation of the passport-saml extension.
Once set, appcelerator-saml checks if current user is authenticated, for all routes (except for the loginUrl). You can add exceptions ( routes / endpoints which unauthorized users can visit ). Just add paths to the allowedPaths
Array. Don't forget to add loginUrl to it as well.
After you set "appc.saml.default.js"
file, and add APIKeyAuthPlugin to ./conf/default.js
, you have to set the application Routes, which are going to intercept the information sent by the IDp.
This route should be the same, as the one you set as loginRoute in the module's configuration.
var Arrow = require('arrow');
//Require the Module
var SamlAuth = require('appcelerator-saml');
//Instantiate the SamlAuth and pass a server instance to the constructor
var auth = new SamlAuth(Arrow);
var LoginRoute = Arrow.Router.extend({
name: 'login',
path: '/saml/login',
method: 'GET',
description: 'Application login route',
action: auth.passport.authenticate('saml',
{
failureRedirect: "/saml/login-error" // where the user gets redirected on errror
})
});
module.exports = LoginRoute;
The auth.passport.authenticate
method redirects the user to the login page of the identity provider ( entryPoint ).
This route should match callbackUrl
parameter from the config. This is where appcelerator-saml, grabs the response from the IDP and persists the data. You can later on access the data, trough the application's Request object.
var Arrow = require('arrow');
var SamlAuth = require('appcelerator-saml');
var auth = new SamlAuth(Arrow);
var CallbackRoute = Arrow.Router.extend({
name: 'sso_callback',
path: '/saml/response/callback',
method: 'POST',
description: 'Authorization page',
action: auth
.passport
.authenticate('saml', {
successRedirect : '/', // Redirect user to this route on success
failureRedirect: '/saml/login-error', // Redirect on error
})
});
module.exports = CallbackRoute;
The successRedirect
property of auth.passport.authenticate, is the route where the user is going to be redirected on success.
Set the privateCertLocation and certLocation (the location of the .pem and .crt files), to enable certificate authentication
The authentication information is accessable trough the Arrow's Request object
request.isAuthenticated() // returns wether the user is authenticated
request.user // returns user information object ( the one you set with resultObject )
Let's create a api endpoint that returns information on currently logged user.
var Arrow = require('arrow');
var UserAPI = Arrow.API.extend({
group: 'userapi',
path: '/loggeduser',
method: 'GET',
description: 'API information about logged in user',
action: function (req, resp, next) {
user_data = req.user
resp.stream(getLoggedinData, next);
}
});
var user_data = {};
function getLoggedinData(callback)
{
callback(null,user_data);
}
module.exports = UserAPI;
var Arrow = require('arrow');
var LogoutRoute = Arrow.Router.extend({
name: 'logout',
path: '/saml/logout',
method: 'GET',
description: 'Application logout route',
action: function (request, response) {
request.logout();
response.redirect('/welcome');
}
});
module.exports = LogoutRoute;
FAQs
Appcelerator Arrow authentication using SAML strategy
The npm package appcelerator-saml receives a total of 6 weekly downloads. As such, appcelerator-saml popularity was classified as not popular.
We found that appcelerator-saml demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.