Gathering detailed insights and metrics for @sbb-esta/angular-keycloak
Gathering detailed insights and metrics for @sbb-esta/angular-keycloak
Gathering detailed insights and metrics for @sbb-esta/angular-keycloak
Gathering detailed insights and metrics for @sbb-esta/angular-keycloak
npm install @sbb-esta/angular-keycloak
Typescript
Module System
Release 20.0.1
Updated on Jun 19, 2025
Release 20.0.0
Updated on Jun 12, 2025
Release 20.0.0-next.4
Updated on Jun 11, 2025
Release 20.0.0-next.3
Updated on Jun 05, 2025
Release 20.0.0-next.2
Updated on Jun 05, 2025
Release 19.1.6
Updated on Apr 07, 2025
TypeScript (84.09%)
SCSS (6.46%)
HTML (4.6%)
Starlark (3.45%)
JavaScript (1.15%)
CSS (0.19%)
Shell (0.03%)
Dockerfile (0.02%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
115 Stars
5,054 Commits
22 Forks
10 Watchers
66 Branches
39 Contributors
Updated on Jul 04, 2025
Latest Version
12.4.0
Package Id
@sbb-esta/angular-keycloak@12.4.0
Unpacked Size
136.66 kB
Size
32.19 kB
File Count
31
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
🛈 We recommend angular-oauth2-oidc to be used for authentication. See the documentation for details.
The @sbb-esta/angular-keycloak
package is deprecated and will be removed with the next major version.
As mentioned above, we strongly recommend angular-oauth2-oidc.
To use @sbb-esta/angular-keycloak you need to have node and npm installed. You can then install @sbb-esta/angular-keycloak with the following command:
npm install --save @sbb-esta/angular-keycloak keycloak-js@4.8.3
The authentication module provides functionality for SSO with Keycloak. It provides an authentication service that you can use to handle all your authentication tasks.
It also provides an optional interceptor (Angular Interceptor). It is not contained in the authentication module but can be used by adding AUTH_INTERCEPTOR to the AppModule.
After the redirect from the authentication server, keycloak needs to be notified even before Angular has started. This is achieved by using Angular App Initializers.
You can import the AuthModule in your app module or in your core module. Use the forRoot method to provide the configuration.
The keycloak configuration has to match the following interface:
interface KeycloakConfig {
url?: string;
realm?: string;
clientId?: string;
}
...
import { AuthModule, AUTH_INTERCEPTOR } from '@sbb-esta/angular-keycloak';
import { environment } from '../environment/environment'; // Your Angular CLI Environment config
@NgModule({
imports: [
AuthModule.forRoot(environment.authConfig)
],
declarations: [...],
providers: [
AUTH_INTERCEPTOR // Optional
]
})
export class CoreModule {
}
The AuthService is available via dependency injection inside your application.
import { AuthService } from '@sbb-esta/angular-keycloak';
@Component({
selector: ...,
templateUrl: ...
})
export class SampleComponent{
constructor(private authService: AuthService) {
}
}
The Authentication Module provides the authentication service. It exposes the static forRoot method to configure authentication.
AuthModule.forRoot(
config: string | KeycloakConfig,
options?: KeycloakInitOptions,
loginOptions?: KeycloakLoginOptions)
Parameter | Description |
---|---|
config | Required Either a configuration object or an url where the configuration is provided in json format |
options | Optional Options object (defaults to { onLoad: 'check-sso', flow: 'implicit' }) |
loginOptions | Optional Login options object, which will be used on AuthService.login (defaults to { idpHint: 'azure_sbb_prod' }) |
The Authentication Service provides the necessary API to interact with the authentication module.
Method | Description |
---|---|
login: Promise | When you call this method you are redirected to the authentication server where you need to enter your credentials. After a successful login you are then redirect to your app. The AuthModule then internally stores the authorization token. This token is stored persistent. It is also available after a window refresh. You can get the token by calling the getToken() method of the auth service. |
getToken: string | This method returns the stored token. Notice that it only returns the token and not the complete authHeader. To get the authHeader you can use the getAuthHeader() method on the authService. |
getAuthHeader: any | This method returns an auth header object. This auth header object has an authorization property that contains Bearer + token as value. |
refreshToken: Promise | This method allows you to refresh the token. It returns a promise that indicates if the refresh has been successful or not. Don't forget to call getToken() again to get the refreshed token. |
getUserInfo: Observable | This method returns you an Observable who streams the user profile. This user profile has the following structure. - id?: string - username?: string - email?: string - firstName?: string - lastName?: string - enabled?: boolean - emailVerified?: boolean - totp?: boolean - createdTimestamp?: number |
authenticated: boolean | Returns a boolean that indicates if the user is authenticated or not. |
logout: Promise | logout: voidThis method will logout the current user and remove the token from the auth module. |
No vulnerabilities found.
Reason
30 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
packaging workflow detected
Details
Reason
SAST tool is run on all commits
Details
Reason
license file detected
Details
Reason
Found 19/28 approved changesets -- score normalized to 6
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
13 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More