@chustasoft/cs-authorization-connector

JS connector library for ChustaSoft Authorization library based on Microsoft AspNet Identity

Usage no npm install needed!

<script type="module">
  import chustasoftCsAuthorizationConnector from 'https://cdn.skypack.dev/@chustasoft/cs-authorization-connector';
</script>

README

cs-authorization-connector

Frontend tool

ChustaSoft Authorization provides a npm package (@chustasoft/cs-authorization-connector) that allow a frontend to connect with the exposed Controller actions of the AspNet package.

This package is developed purely in TypeScript, so the package can easily integrated in any kind of JavaScript project.

The package provides:

  • AuthorizationService: Connection service with the WebApi
    • async register(credentials: Credentials): Promise
    • async login(credentials: Credentials): Promise
    • async confirm(userValidation: UserValidation): Promise
    • async activate(userActivation: UserActivation): Promise

Example on Angular application

  1. Install @chustasoft/cs-authorization-connector package

  2. Recommended usage of Service with Angular injection:


import { Injectable, Inject } from '@angular/core';
import { AuthorizationService } from '@chustasoft/cs-authorization-connector';

@Injectable({
  providedIn: 'root'
})
export class AuthService extends AuthorizationService {

  //Could it be environment file inestad
  constructor(@Inject('BASE_URL') baseUrl: string)
  {    
    super(baseUrl);
  }

}

With this approach, we will be both injecting the necessary configuration of the base URL of the API to the connector service, and adding the service to the Angular DI Container, therefore available for any component.

You will be able to found a complete example with Backend + Frontend, using Nuget packages and npm connector here