Skip to content

Commit

Permalink
feat: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yisraelx committed Feb 6, 2018
0 parents commit 1aa2963
Show file tree
Hide file tree
Showing 427 changed files with 28,234 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
indent_style = space
end_of_line = lf
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### IDE
.vscode/
.idea/

### Node
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.changelog
node_modules/

### Build
lib/
build/
dist/
old/
tmp/
.tmp
.rpt2_cache/
es5/
es2015/
bundles/
typings/
coverage/
packages/**/LICENSE
examples/**/LICENSE
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sudo: false
language: node_js
node_js:
- '8.9.4'
cache:
yarn: true
directories:
- node_modules
notifications:
email: false
branches:
only:
- master
except:
- /^v\d+\.\d+\.\d+$/
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH

install: yarn install --frozen-lockfile

script: yarn ci:script
after_success: yarn ci:after
1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workspaces-experimental true
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright © 2017 Yisrael Eliav

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Authllizer
[![Travis build](https://travis-ci.org/yisraelx/authllizer.svg?branch=master)](https://travis-ci.org/yisraelx/authllizer)
[![Codecov](https://codecov.io/gh/yisraelx/authllizer/branch/master/graph/badge.svg)](https://codecov.io/gh/yisraelx/authllizer)
[![MIT License](https://img.shields.io/github/yisraelx/authllizer.svg)](https://github.com/yisraelx/authllizer/blob/master/LICENSE)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

### Authllizer is a authentication framework for the client-side of javascript applications, written in typescript.

## Packages
* [@authllizer/core](https://www.npmjs.com/package/@authllizer/core) - Authllizer Library
* [@authllizer/ng](https://www.npmjs.com/package/@authllizer/ng) - Authllizer Module for AngularJs
* [@authllizer/ngx](https://www.npmjs.com/package/@authllizer/ngx) - Authllizer Module for Angular X
* [@authllizer/vue](https://www.npmjs.com/package/@authllizer/vue) - Authllizer Plugin for VueJs

## Examples
There are example projects in the [source code](https://github.com/yisraelx/authllizer/blob/master/examples).
* [AngularJs](https://github.com/yisraelx/authllizer/blob/master/examples/client/ng)
* [Angular X](https://github.com/yisraelx/authllizer/blob/master/examples/client/ngx)
* [Ionic](https://github.com/yisraelx/authllizer/blob/master/examples/client/ionic)
* [VueJs](https://github.com/yisraelx/authllizer/blob/master/examples/client/vue)
* [Electron](https://github.com/yisraelx/authllizer/blob/master/examples/client/electron)

## Docs
There is [docs and examples](https://github.com/yisraelx/authllizer/blob/master/docs) but it is very limited hope that it will change later and welcome to help with the matter.

## Scripts
* bootstrap - for install and link all the dependencies in all packages in the repo (with yarn workspace).
* cm - for commit with commitizen for conventional changelog.
* lint - run tslint an all the *.ts file in the packages.
* test - run test on all packages.

## Test
There are partial tests, welcome to help add tests and improve existing tests (the goal is for full coverage).
```sh
$ npm install
$ npm test
```

## TODO:
* Add example for
- [ ] React
* Add dialog for
- [ ] React Native
- [ ] Native Script

## Credits
This library is based on AngularJs [Satellizer](https://github.com/sahat/satellizer) library developed by [Sahat Yalkabov](https://github.com/sahat).

## License
Copyright © 2017 [Yisrael Eliav](https://github.com/yisraelx),
Licensed under the [MIT license](https://github.com/yisraelx/authllizer/blob/master/LICENSE).
5 changes: 5 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: [
'@commitlint/config-angular'
]
};
49 changes: 49 additions & 0 deletions config/rollup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import sourceMaps from 'rollup-plugin-sourcemaps';
import typescript from 'rollup-plugin-typescript2';
import minify from 'rollup-plugin-minify';
import * as _ from 'lodash';
import {join} from 'path';

let PKG = require(join(process.cwd(), 'package.json'));

let banner = `/**
* ${PKG.name} (${PKG.homepage})
* @version ${PKG.version}
* @license ${PKG.license}
* @copyright ${PKG.author.name} <${PKG.author.email}> (${PKG.author.url})
*/`;

let globals = _.get(PKG, 'rollup.globals', {});

export default {
input: `./src/index.ts`,
output: [
{
file: PKG.browser,
name: `authllizer.${_.camelCase(PKG.name.replace(/@?authllizer[-\/]?/g, ''))}`,
format: 'umd',
exports: 'named',
banner,
sourcemap: true,
globals
}
],
external: _.keys(globals),
plugins: [
typescript({
tsconfigOverride: {
compilerOptions: {
target: 'es5'
}
},
useTsconfigDeclarationDir: true,
clean: true
}),
commonjs(),
resolve(),
sourceMaps(),
minify({umd: PKG.browser.replace('.js', '.min.js')})
]
};
9 changes: 9 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Docs
* [Authllizer](https://github.com/yisraelx/authllizer/blob/master/docs/authllizer.md)
* [Adapter](https://github.com/yisraelx/authllizer/blob/master/docs/adapter.md)
* [Dialog](https://github.com/yisraelx/authllizer/blob/master/docs/dialog.md)
* [Http](https://github.com/yisraelx/authllizer/blob/master/docs/http.md)
* [Interceptor](https://github.com/yisraelx/authllizer/blob/master/docs/interceptor.md)
* [Provider](https://github.com/yisraelx/authllizer/blob/master/docs/provider.md)
* [Storage](https://github.com/yisraelx/authllizer/blob/master/docs/storage.md)
* [Token](https://github.com/yisraelx/authllizer/blob/master/docs/token.md)
72 changes: 72 additions & 0 deletions docs/adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Adapter
The Adapter is the component that bridges the Authllizer to api on your server side or your authentication service


You can use the Authllizer BackendAdapter (most cases of use)
```ts
import { Authllizer, BackendAdapter } from '@authllizer/core';

new Authllizer({
adapter: BackendAdapter, // the default is BackendAdapter
// ...
});
```
With options
```ts
import { Authllizer, BackendAdapter, IBackendAdapterOptions } from '@authllizer/core';

new Authllizer({
adapter: BackendAdapter.extend({
baseUrl: 'https://example.com/auth', // the default is '/auth'
tokenPath: 'data.token', // the default is 'access_token' - { "access_token": "***" }
// ...
} as IBackendAdapterOptions),
// ...
});
```
or
```ts
import { Authllizer, BackendAdapter, IBackendAdapterOptions } from '@authllizer/core';

export interface ISomeServiceAdapterOptions extends IBackendAdapterOptions{
apiKey?: string;
}

export class SomeServiceAdapter extends LocalAdapter{

static extend: (options: ISomeServiceAdapterOptions) => typeof SomeServiceAdapter;

baseUrl = 'https://someservice.com';
signIn = '/login';
signOut = {
url: '/logout'
httpOptions: {
params: {foo: 'bar'}
}
};

set apiKey(apiKey: string){
this.defaultRequestOptions.params.apiKey = apiKey;
}

}
```
or you can create an adapter according to your needs
```ts
import { IAdapter } from '@authllizer/core';

export class SomeServiceAdapter implements IAdapter{
// ...
}
```

If you created Adapter for an service (authentication, dbs, etc.), then you might want to publish it to npm, so that other users can easily connect to this service.

Recommended settings on publishing to npm:
```json
// package.json
{
"name": "authllizer-< service name >-adapter", // authllizer-some-adapter
"keywords": [ "authllizer", "authllizer-adapter"]
}
```
Loading

0 comments on commit 1aa2963

Please sign in to comment.