Authllizer
Authllizer is a authentication framework for the client-side of javascript applications, written in typescript.
Examples
There are example projects in the source code.
Install
$ npm install --save @authllizer/core
Use
class instance
import authllizer, { IConfigOptions } from '@authllizer/core';
authllizer.config({...} as IConfigOptions);
import { default as authllizer, Authllizer, IConfigOptions } from '@authllizer/core';
authllizer === Authllizer.instance; // => true
and also (like singleton)
import {Authllizer} from '@authllizer/core';
new Authllizer === Authllizer.instance; // => true
to create a new authllizer instance
import { Authllizer, IAuthllizerOptions } from '@authllizer/core';
let authllizer: Authllizer = new Authllizer({
useClassInstance: false // by default it true and acting like a singleton
// ...
} as IAuthllizerOptions);
config
import authllizer, { IConfigOptions, BackendAdapter, BrowserDialog, FetchHttpClient, OAuth2Provider, LocalStorage, JWT } from '@authllizer/core';
authllizer.config({
adapter: BackendAdapter.extend({
baseUrl: 'https://example.com/auth',
signIn: '/login',
signOut: {
url: '/logout',
httpOptions: {
params: {foo: 'bar'}
}
}
}),
dialog: BrowserDialog, // this is the default
httpClient: new FetchHttpClient(), // this is the default
interceptList: ['https://example.com'],
providers: {
some: OAuth2Provider.extend({
name: 'some',
clientId: '***'
//...
}
},
storage: new LocalStorage(), // this is the default
token: JWT // this is the default
} as IConfigOptions);
Docs
Compatibility
This library are written in typescript and available in ES5 and ES6 standard.
Promise
This library requires ES6 Promise (native or polyfill) by default it uses the global "Promise".
fetch
By default HttpClient is FetchHttpClient and by default it uses the global "fetch" (native or polyfill). if you want to define specific fetch library then:
import { Authllizer, FetchHttpClient, } from '@authllizer/core';
import fetch from 'library';
let authllizer: Authllizer = new Authllizer({
httpClient: new FetchHttpClient(fetch),
// ...
});
Note: You can use another library as http client see in the doc HttpClient.
Credits
This library is based on AngularJs Satellizer library developed by Sahat Yalkabov.
License
Copyright © 2017 Yisrael Eliav, Licensed under the MIT license.