9.5.0 • Published 4 years ago

@knora/authentication v9.5.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Knora-ui authentication module

npm (scoped)

This module is part of Knora-ui modules, developed by the team at the Data and Service Center for Humanities DaSCH.

The authentication module contains the login form (for standalone usage) or a complete login- / logout-button environment incl. the login form.

Prerequisites

For help getting started with a new Angular app, check out the Angular CLI.

For existing apps, follow these steps to begin using Knora-ui authentication.

Install

You can use either the npm or yarn command-line tool to install packages. Use whichever is appropriate for your project in the examples below.

Yarn

$ yarn add @knora/authentication

NPM

$ npm install @knora/authentication

Dependencies

This module has the following package dependencies, which you also have to install.

  • @angular/common@8.0.3
  • @angular/core@8.0.3
  • @angular/animations@8.0.3
  • @angular/cdk@8.1.4
  • @angular/material@8.1.4
  • @knora/action@9.5.0
  • @knora/core@9.5.0
  • moment@2.22.2

Required version of Knora: 10.0.0

Setup

In your AppModule you have to define the following providers:

import { ErrorInterceptor, JwtInterceptor, KuiAuthenticationModule } from '@knora/authentication';

@NgModule({
    declarations: [
        ...
    ],
    imports: [
        BrowserModule,
        HttpClientModule,
        RouterModule,
        KuiCoreModule.forRoot({
            name: 'Knora-ui Demo App',
            api: environment.api,
            media: environment.media,
            app: environment.app,
        }),
        KuiAuthenticationModule
    ],
    providers: [
        {provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true}
    ]
})
export class AppModule { }

Usage of KuiAuthGuard

The @knora/authentication module contains a guard class which can be used in a restricted app component and will redirect a guest user to the login page. It can be used in the app routing as follow:

import { AuthGuard } from '@knora/authentication';

const appRoutes: Routes = [
    {
        path: '',
        component: AppComponent,
        canActivate: [AuthGuard]
    },
    {
        path: 'login',
        component: LoginFormComponent
    }
]

Usage of kui-login-form

The LoginFormComponent in the app needs in principle only the <kui-login-form></kui-login-form> tag. Additional it's also possible to define e navigation route, where the user will be redirected after successful login: <kui-login-form [navigate]="'/dashboard'"></kui-login-form>

9.5.0

4 years ago

9.4.1

5 years ago

9.4.0

5 years ago

9.3.0

5 years ago

9.2.0

5 years ago

9.1.0

5 years ago

9.0.0

5 years ago

8.2.0

5 years ago

8.1.0

5 years ago

8.0.0

5 years ago

7.6.0

5 years ago

7.5.0

5 years ago

7.4.0

5 years ago

7.3.0

5 years ago

7.2.0

5 years ago

7.1.0

5 years ago

7.0.1

5 years ago

7.0.0

5 years ago

6.7.0

5 years ago

6.6.0

5 years ago

6.5.0

5 years ago

6.5.0-beta.1

5 years ago

6.5.0-beta

5 years ago

6.0.0

5 years ago

1.0.0-alpha.5

6 years ago

1.0.0-alpha.4

6 years ago

1.0.0-alpha.3

6 years ago

1.0.0-alpha.2

6 years ago

1.0.0-alpha.1

6 years ago

1.0.0-alpha

6 years ago

0.0.5

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago