0.5.0 • Published 1 year ago

@starnetbih/au2-servicestack-auth v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

au2-servicestack-auth

Aurelia 2 auth library for servicestack. JWT Tokens are maintained via Secure HttpOnly Cookies. This plugin depends on:

  • @starnetbih/au2-configuration
  • @starnetbih/au2-api

Make sure that your src directory contains config directory with config.json file in it. So:

  • app
    • src
      • config
        • config.json

Add 'au2-api' section with key 'authApi' with url and auth set to true.

config.json example

{
 "au2-api": {
  "authApi": {
   "url": "https://localhost:5010",
   "auth": true
  }
 }
}

Full disclosure: this plugin is in alpha stage. Use at your own risk.

Installation

npm install @starnetbih/au2-servicestack-auth or yarn add @starnetbih/au2-servicestack-auth

Usage

import { IAuthService, IUserProfile, SS_AUTH_CHANNEL_SIGNED_IN, SS_AUTH_CHANNEL_SIGNED_OUT } from '@starnetbih/au2-servicestack-auth';
import { IEventAggregator } from 'aurelia';

export class MyApp {
 constructor(
    @IAuthService private Auth: IAuthService,
    @IEventAggregator readonly EventAggregator: IEventAggregator) {
        this.EventAggregator.subscribe(SS_AUTH_CHANNEL_SIGNED_IN, (usr) => {
            console.log(`${(usr as IUserProfile).displayName} signed in!`);
            console.log(usr);
        });
        this.EventAggregator.subscribe(SS_AUTH_CHANNEL_SIGNED_OUT, () => {
            console.log('User signed out');
        });
    }

    async attached() {
       await this.Auth.signIn({ username: "admin", password: "admin" });
       await this.Auth.signOut();
    }
}
0.5.0

1 year ago

0.4.10

2 years ago

0.4.13

2 years ago

0.4.14

2 years ago

0.4.11

2 years ago

0.4.6

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.4.2

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.4

2 years ago