npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

los-auth

v1.0.20

Published

Libreria de autenticacion para las aplicaciones internas de la empresa LOS

Downloads

42

Readme

LOS-AUTH

Librería para uso de módulo o aplicaciones desarrolladas para el sistema de LOS.

Prerequisitos

Es necesario contar con la versión de Angular 5 o posterior.

Tabla de contenido

Instalación

npm install --save los-auth

Implementación

En el archivo de app.module.ts importaremos el módulo de autenticación de LOS.

import { LosAuthModule } from 'los-auth';

Y despues lo agregaremos en el bloque de imports en @NgModule de la siguiente manera:

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    LosAuthModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})

Ya con esto estarás incorporando los servicios de autenticación e interceptores necesarios la creación de módulos para el sistema LOS

Servicios

login(LosLoginModel) : LosAuthResponseModel

Para poder realizar un Login es necesario importar LosAuthService y LosLoginModel en el componente donde se requiera utilizar los servicios.

import { LosAuthService, LosLoginModel } from 'los-auth';

Hacer instancia en el constructor de LosAuthService de la siguiente manera:

constructor(
    private authService: LosAuthService
) { }

Y para poder realizar un login es necesario realizar las siguientes instrucciones en la función que ejecutará el evento.

const data: LosLoginModel = {
    username: 'moises.aleman',
    password: 'secret',
    client_id: 'client_id',
    url: 'http:/url-auth/auth',
    grant_type: 'password'
}

this.authService.login(data).subscribe(response => {
    /* Success */
}, responseError => {
    /* Error */
});

En caso de que la petición sea exitosa la respuesta sera:

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTUxMiJ9.eyJpZCI6IjE0MjUiLCJ1c2VybmFtZSI6IjYwMDYxNCIsInVzZXJkb21haW4iOiJtb2lzZXMuYWxlbWFuIiwidXNlcnNhcCI6Im1hbGVtYW4iLCJuYW1lIjoiTW9pc2VzIEFsYmVydG8iLCJsYXN0bmFtZSI6IkFsZW1hbiBNYWNpYXMiLCJza2luIjoiYmctaW5kaWdvIiwicGVyc29uIjoie1wiSURcIjoxNTAxMyxcIk5hbWVcIjpcIk1vaXNlcyBBbGJlcnRvXCIsXCJMYXN0TmFtZVwiOlwiQWxlbWFuIE1hY2lhc1wiLFwiQmlydGhkYXlcIjpcIjE5OTItMDEtMjBUMDA6MDA6MDBcIixcIkdlbmRlcl.806qA2bcwuZPxmvRHrnNjIkS1XLzc3x9Poz_3YWrB9Q6hwoll9_PHbwQHNKqWJglm79BxN82nZeVSf68CVbaYA",
    "token_type": "bearer",
    "expires_in": 43199,
    "id": "1425",
    "username": "",
    "audience": "cc73800ebd6544d2aec59ca41",
    "person": "",
    "roles": "",
    "salas": "",
    "user_applications": "",
    ".issued": "Tue, 09 Jan 2018 00:25:36 GMT",
    ".expires": "Tue, 09 Jan 2018 12:25:36 GMT"
}

logout(): Boolean

Podrás realizar un logout mediante el método disponible en el servicio de LosAuthService.

isLogged(): Boolean

Verifica si el usuario está loggeado.

getUserActive(): LosAuthModel

Obtiene el usuario que está activo en ese momento (usuario que realizo login previamente).

getToken(): String

Obtiene el string del token.

getUserRoles(): String[]

Obtiene todos los roles del usuario.

hasPermission(String[]): Boolean

Valida si los roles enviados en arreglo están en los roles del usuario.

getUserApplications(): String[]

Obtiene todas las aplicaciones que tiene acceso el usuario.

changePassword(LosChangePassword): Any

Cambia la contraseña del usuario actual.

switchSkinTheme(String): Any

Cambia el skin por defecto del usuario.

getUserSkin(): String

Obtiene el skin del usuario.

getUserRooms(): String[]

Obtiene todas las salas que tiene asignadas el usuario.

getUserRoomDefault(): String

Obtiene la sala defecto del usuario.

setRoomActive(String): Boolean

Setea en navegador la sala activa que seleccionó del listado el usuario.

getRoomActive(): String

Obtiene la sala activa que está seteada en el navegador.