From 20cbf0c710f5eece109148fb015bc9606df45971 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Wed, 15 Apr 2015 17:38:10 +0200 Subject: [PATCH] Initial commit. --- packages/xo-server-auth-saml/.babelrc | 15 +++ packages/xo-server-auth-saml/.editorconfig | 65 +++++++++++++ packages/xo-server-auth-saml/.gitignore | 8 ++ packages/xo-server-auth-saml/.mocha.js | 3 + packages/xo-server-auth-saml/.mocha.opts | 1 + packages/xo-server-auth-saml/.npmignore | 10 ++ packages/xo-server-auth-saml/.travis.yml | 6 ++ packages/xo-server-auth-saml/README.md | 94 +++++++++++++++++++ packages/xo-server-auth-saml/package.json | 55 +++++++++++ .../xo-server-auth-saml/src/index.spec.js | 11 +++ 10 files changed, 268 insertions(+) create mode 100644 packages/xo-server-auth-saml/.babelrc create mode 100644 packages/xo-server-auth-saml/.editorconfig create mode 100644 packages/xo-server-auth-saml/.gitignore create mode 100644 packages/xo-server-auth-saml/.mocha.js create mode 100644 packages/xo-server-auth-saml/.mocha.opts create mode 100644 packages/xo-server-auth-saml/.npmignore create mode 100644 packages/xo-server-auth-saml/.travis.yml create mode 100644 packages/xo-server-auth-saml/README.md create mode 100644 packages/xo-server-auth-saml/package.json create mode 100644 packages/xo-server-auth-saml/src/index.spec.js diff --git a/packages/xo-server-auth-saml/.babelrc b/packages/xo-server-auth-saml/.babelrc new file mode 100644 index 000000000..5e9978a41 --- /dev/null +++ b/packages/xo-server-auth-saml/.babelrc @@ -0,0 +1,15 @@ +{ + "comments": false, + "compact": true, + "optional": [ + // Experimental features. + // "minification.constantFolding", + // "minification.deadCodeElimination", + + "es7.asyncFunctions", + "es7.decorators", + "es7.exportExtensions", + "es7.functionBind", + "runtime" + ] +} diff --git a/packages/xo-server-auth-saml/.editorconfig b/packages/xo-server-auth-saml/.editorconfig new file mode 100644 index 000000000..da21ef4c5 --- /dev/null +++ b/packages/xo-server-auth-saml/.editorconfig @@ -0,0 +1,65 @@ +# http://EditorConfig.org +# +# Julien Fontanet's configuration +# https://gist.github.com/julien-f/8096213 + +# Top-most EditorConfig file. +root = true + +# Common config. +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespaces = true + +# CoffeeScript +# +# https://github.com/polarmobile/coffeescript-style-guide/blob/master/README.md +[*.{,lit}coffee] +indent_size = 2 +indent_style = space + +# Markdown +[*.{md,mdwn,mdown,markdown}] +indent_size = 4 +indent_style = space + +# Package.json +# +# This indentation style is the one used by npm. +[/package.json] +indent_size = 2 +indent_style = space + +# Jade +[*.jade] +indent_size = 2 +indent_style = space + +# JavaScript +# +# Two spaces seems to be the standard most common style, at least in +# Node.js (http://nodeguide.com/style.html#tabs-vs-spaces). +[*.js] +indent_size = 2 +indent_style = space + +# Less +[*.less] +indent_size = 2 +indent_style = space + +# Sass +# +# Style used for http://libsass.com +[*.s[ac]ss] +indent_size = 2 +indent_style = space + +# YAML +# +# Only spaces are allowed. +[*.yaml] +indent_size = 2 +indent_style = space diff --git a/packages/xo-server-auth-saml/.gitignore b/packages/xo-server-auth-saml/.gitignore new file mode 100644 index 000000000..384949d8a --- /dev/null +++ b/packages/xo-server-auth-saml/.gitignore @@ -0,0 +1,8 @@ +/bower_components/ +/dist/ + +npm-debug.log +npm-debug.log.* + +!node_modules/* +node_modules/*/ diff --git a/packages/xo-server-auth-saml/.mocha.js b/packages/xo-server-auth-saml/.mocha.js new file mode 100644 index 000000000..b888fb4d5 --- /dev/null +++ b/packages/xo-server-auth-saml/.mocha.js @@ -0,0 +1,3 @@ +try { require('clarify') } catch (_) {} +try { require('trace') } catch (_) {} +try { require('source-map-support/register') } catch (_) {} diff --git a/packages/xo-server-auth-saml/.mocha.opts b/packages/xo-server-auth-saml/.mocha.opts new file mode 100644 index 000000000..6cfd94898 --- /dev/null +++ b/packages/xo-server-auth-saml/.mocha.opts @@ -0,0 +1 @@ +--require ./.mocha.js diff --git a/packages/xo-server-auth-saml/.npmignore b/packages/xo-server-auth-saml/.npmignore new file mode 100644 index 000000000..c31ee82cb --- /dev/null +++ b/packages/xo-server-auth-saml/.npmignore @@ -0,0 +1,10 @@ +/examples/ +example.js +example.js.map +*.example.js +*.example.js.map + +/test/ +/tests/ +*.spec.js +*.spec.js.map diff --git a/packages/xo-server-auth-saml/.travis.yml b/packages/xo-server-auth-saml/.travis.yml new file mode 100644 index 000000000..d38f7e60a --- /dev/null +++ b/packages/xo-server-auth-saml/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - 'iojs-v2' + - 'iojs-v1' + - '0.12' + - '0.10' diff --git a/packages/xo-server-auth-saml/README.md b/packages/xo-server-auth-saml/README.md new file mode 100644 index 000000000..d4a51dcc9 --- /dev/null +++ b/packages/xo-server-auth-saml/README.md @@ -0,0 +1,94 @@ +# xo-server-auth-saml [![Build Status](https://travis-ci.org/vatesfr/xo-server-auth-saml.png?branch=master)](https://travis-ci.org/vatesfr/xo-server-auth-saml) + +**Still in dev: does not work!!!** + +> LDAP authentication plugin for XO-Server + +This plugin allows SAML users to authenticate to Xen-Orchestra. + +The first time a user signs in, XO will create a new XO user with the +same identifier. + +## Install + +Installation of the [npm package](https://npmjs.org/package/xo-server-auth-saml): + +``` +> npm install --save xo-server-auth-saml +``` + +## Usage + +To enable this plugin you have to add it into the configuration file +of XO-Server: + +```yaml +plugins: + + auth-ldap: + uri: "ldap://ldap.example.org" + + # Credentials to use before looking for the user record. + # + # Default to anonymous. + bind: + + # Distinguished name of the user permitted to search the LDAP + # directory for the user to authenticate. + # + # For Microsoft Active Directory, it can also be + # `'@'` + dn: 'cn=admin,ou=people,dc=example,dc=org' + + # Password of the user permitted to search the LDAP directory. + password: 'secret' + + # The base is the part of the directory tree where the users are + # looked for. + base: "ou=people,dc=example,dc=org" + + # Filter used to find the user. + # + # For Microsoft Active Directory, the filter should be + # `'(cn={{name}})'` or `'(sAMAccountName={{name}}@)'`. + # + # Default is `'(uid={{name}})'`. + #filter: '(uid={{name}})' +``` + +## Development + +### Installing dependencies + +``` +> npm install +``` + +### Compilation + +The sources files are watched and automatically recompiled on changes. + +``` +> npm run dev +``` + +### Tests + +``` +> npm run test-dev +``` + +## Contributions + +Contributions are *very* welcomed, either on the documentation or on +the code. + +You may: + +- report any [issue](https://github.com/vatesfr/xo-server-auth-saml/issues) + you've encountered; +- fork and create a pull request. + +## License + +AGPL3 © [Vates SAS](http://vates.fr) diff --git a/packages/xo-server-auth-saml/package.json b/packages/xo-server-auth-saml/package.json new file mode 100644 index 000000000..9ea360036 --- /dev/null +++ b/packages/xo-server-auth-saml/package.json @@ -0,0 +1,55 @@ +{ + "name": "xo-server-auth-saml", + "version": "0.0.0", + "license": "AGPL3", + "description": "SAML authentication plugin for XO-Server", + "keywords": [ + "xo-server", + "xo-server", + "authentication", + "saml" + ], + "homepage": "https://github.com/vatesfr/xo-server-auth-saml", + "bugs": "https://github.com/vatesfr/xo-server-auth-saml/issues", + "repository": { + "type": "git", + "url": "https://github.com/vatesfr/xo-server-auth-saml" + }, + "author": { + "name": "Julien Fontanet", + "email": "julien.fontanet@isonoe.net" + }, + "preferGlobal": false, + "main": "dist/", + "bin": {}, + "files": [ + "dist/" + ], + "dependencies": { + "babel-runtime": "^5.7.0" + }, + "devDependencies": { + "babel": "^5.6.23", + "babel-eslint": "^3.1.23", + "clarify": "^1.0.5", + "mocha": "^2.2.5", + "must": "^0.12.0", + "source-map-support": "^0.3.2", + "standard": "^4.5.4", + "trace": "^1.2.0" + }, + "scripts": { + "build": "babel --source-maps --out-dir=dist/ src/", + "dev": "babel --watch --source-maps --out-dir=dist/ src/", + "lint": "standard", + "prepublish": "npm run build", + "test": "npm run lint && mocha --opts .mocha.opts \"dist/**/*.spec.js\"", + "test-dev": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\"" + }, + "standard": { + "ignore": [ + "dist/**" + ], + "parser": "babel-eslint" + } +} diff --git a/packages/xo-server-auth-saml/src/index.spec.js b/packages/xo-server-auth-saml/src/index.spec.js new file mode 100644 index 000000000..8c97004d5 --- /dev/null +++ b/packages/xo-server-auth-saml/src/index.spec.js @@ -0,0 +1,11 @@ +/* eslint-env mocha */ + +import expect from 'must' + +// =================================================================== + +import myLib from './' + +// =================================================================== + +describe('myLib')