New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

keycloak-angular

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keycloak-angular

Easy Keycloak setup for Angular applications

  • 9.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created

What is keycloak-angular?

The keycloak-angular package is an Angular library that provides integration with Keycloak, an open-source identity and access management solution. It allows Angular applications to easily authenticate users and manage user sessions using Keycloak.

What are keycloak-angular's main functionalities?

User Authentication

This feature allows you to initialize Keycloak in your Angular application and enforce user authentication. The code sample demonstrates how to configure Keycloak with the server URL, realm, and client ID, and ensure that the user is logged in before accessing the application.

import { KeycloakService } from 'keycloak-angular';

constructor(private keycloakService: KeycloakService) {}

async ngOnInit() {
  await this.keycloakService.init({
    config: {
      url: 'https://keycloak-server/auth',
      realm: 'my-realm',
      clientId: 'my-client'
    },
    initOptions: {
      onLoad: 'login-required'
    }
  });
}

Role-Based Access Control

This feature enables role-based access control by checking if the authenticated user has a specific role. The code sample shows how to use the KeycloakService to verify if the user possesses a particular role, which can be used to control access to certain parts of the application.

import { KeycloakService } from 'keycloak-angular';

constructor(private keycloakService: KeycloakService) {}

hasRole(role: string): boolean {
  return this.keycloakService.isUserInRole(role);
}

Token Management

This feature provides token management capabilities, allowing you to retrieve the current user's authentication token. The code sample demonstrates how to use the KeycloakService to obtain the token, which can be used for making authenticated API requests.

import { KeycloakService } from 'keycloak-angular';

constructor(private keycloakService: KeycloakService) {}

async getToken(): Promise<string> {
  return await this.keycloakService.getToken();
}

Other packages similar to keycloak-angular

Keywords

FAQs

Package last updated on 30 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc