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

@innotec/auth-plugin

v5.2.22

Published

The plugin to authorize on innotec infrastructure

Downloads

315

Readme

Innotec Auth Plugin

The Innotec-Auth-Plugin is designed to handle all authentication processes for applications where's conntected to the innotec v2 infrastructure. Theses plugin provides different authentication processes:

  • Authentication over authentication providers (Google, PayPal, Facebook ...)
  • Authentication over the Innotec V2 Infrastructure (Authentication by username and password)

With this module its easy to connect the infrastructure.

Installation

NOTE: please use npm 3.* ((sudo) npm i -g npm@3)

npm i --save --save-exact @innotec/auth-plugin

Note!

The npm Module innotec-auth-plugin is deprecated. All Modules are provided in root of @innotec

Import in your app module

You can import the module in your Application with:

import { InnotecAuthPlugin } from "innotec-auth-plugin";

Integration Steps

First

At first you must set your personal options of your app. To set this options call the initAuth Service by APP_INITIALIZER in app.module:


import { InnotecAuthPluginModule, InitAuth } from "../../index";

export function init_app(init: InitAuth): () => Promise<any> {
  return (): Promise<any> => {
    return new Promise((resolve, reject) => {
      (async () => {
        let options = {
          companyLogo: "http://yourLogoURL",    // You can define a own logo of your companyLogo. Default is the logo of the Innotec Company
          clientId: "Innotec Client ID",        // Your clientId from Innotec
          clientSecret: "Innotec Client Secret",// Your clientSecret from Innotec
          facebook_clientId: "abc",             // The Facebook Client_ID for OAuth
          google_clientId: "abc",               // The Google Client_ID for OAuth
          paypal_clientId: "abc",               // The PayPal Client_ID for OAuth
          forgotPassurl: "http://..."           // The Url of the forgot password
          endpoint: "live",                     // Switch for the endpoints. Sandbox is comming soon. live is default.
          newAccountUrl: "url",                 // Defines the url where the user can be register... Default is "https://account.v2.werbasinnotec.com/newaccount"
          closeable: true                       // Boolen to define if the loginwindow is closeable
        };

        await init.module(options);
        resolve();
      })();
    });
  };
}


NgModule({
  imports: [
    InnotecAuthPluginModule,
    .
    .
  ],
  declarations: [
    .
    .
    .
  ],
  providers: [
    JwtHelper,
    {
        provide: APP_INITIALIZER,
        useFactory: init_app,
        deps: [ InitAuth ],
        multi: true,
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
  constructor() {}
}

Second

At next you can import the loginfield in your login page:

<login-field></login-field>

The loginfield provides all necessary services to connect the innotec infrastructure. You can import this field as mat-dialog, too.

Third

To check the loginstate you can call the auth service:

import { CheckAuthStatus } from 'innotec-auth-plugin';

export class YoUrClAsSs {
  constructor (private auth: CheckAuthStatus) {

  }

  public yourService() {
    this.auth.check(); // returns true or false
  }
}

You can subscribe the variable also:

  this.auth.isLoggedIn().subscribe((state) => {
    this.isLoggedIn = state
  });

Additional services

CheckAuthStatus:

  • logout(): User will logged out - Cookie will deleted.
  • getTokenInfo(): Will response all tokeninfo. Ex. userObj.gravatarURL is the users picture

UserRights

  • validateRightTopic([systemId], [RightTopic], [orgaId], [minApiVersion])

With this method it's possible to validate a right-topic by systemId, orgaId and minApiVersion. The property minApiVersion is not required. When it's defined, the method will check the defined Version to the backend. Is the backendVersion greater or equal the minApiVersion the function will return true. (When the user has the right by the topic)

  • getAuthorizedSystems()

This method will response an array with all authorized systems and entrypoints.

InformationService

  • getUserInfos() This method will response the complete userObject where's saved in the cloud backend system.

  • getOrgaInfos(systemId) This method will response the complete OrganizationObject by the called systemId

Store the user-information into electron

With default javascript methods are not possible to store cookies into the chromium extension of electron. To enable the autologin feature / storing user information it's neccessary to save the information by the ipc-renderer module of electron.

Flow

Subscribe the Cookieservice events in app.module.ts of your electron App

import { CookieService } from '@innotec/auth-plugin';

.
.
.

ngOnInit() {
  this.cookie.observe().subscribe(data => {
    // data = { name: <nameofcookie>, value: <valueofcookie>, status: 'NEW || DELETE' }
    // Write the information of data everywhere.. :-)
  });
}

Write the object from the observeable into the authentication plugin on startup (APP_INITIALIZER)

import { InitAuth } from '@innotec/auth-plugin';

.
.
.

  setConfiguration() {
    this.configObject = ....

    this.cookieObject = // Load the object from your IPC Renderer
    .
    .
    .
    this.init(this.configObject, this.cookieObject);
  }
}