0.0.17 • Published 2 years ago

ngx-authentication-oidc v0.0.17

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Angular OIDC Authentication

Build Status npm npm npm code style: prettier

ngx-authentication-oidc is a full fledged authentication solution for Angular using OIDC

Features

The following OIDC features are supported:

The following parts are not supported as they are not typically used for a Single-Page-Application client

Additionally this library features:

  • Automatic logout after an inactivity timeout
  • Automatic session detection at startup using silent logins
  • Automatic access token injection for well defined domains
  • Pre-Configured AuthGuards

The library aims to have a simple yet complete interface for those features consisting of and a comprehensive configuration using meaningful default values.

Among others, this library is tested with Keycloak, Google Identity and Azure AD

Installation

The library can be installed using

npm i angular-oauth2-oidc --save

You then have to add the AuthenticationModule to your own application

import { BrowserModule } from '@angular/platform-browser';
import { AuthenticationModule } from 'ngx-authentication-oidc';

const config = {
  //minimal configuration
  clientId: 'sample-application',
  provider: 'http://localhost:8080/auth/realms/Test-Application',
};

@NgModule({
  imports: [
    HttpClientModule,
    AuthenticationModule.forRoot(config),
    // etc...
  ],
  declarations: [
    AppComponent,
    // etc...
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}

After installation, the library is automatically started and the configured initialization code is executed as soon as the application is started, there is nothing else to do. If you however want to interact with the authentication module in any way, you can inject an instance of AuthService into your angular application.

Note: The library uses the base URI of the application as redirectURI. Do not configure any redirects on the URL '/', otherwise the library will not work properly

Examples

The following examples are provided:

Documentation

Configuration

TODO: OauthConfig.

Initializer

TODO: Initializer

Login Options

TODO: LoginOptions

AuthService

TODO: AuthService

SessionService

TODO: SessionService

Silent Login

TODO:

Testing

TODO: Testing TODO: Testing TODO: Testing

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests and documentation as appropriate.

License

MIT

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.16

2 years ago

0.0.8

2 years ago

0.0.17

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.1

2 years ago