Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nest-keycloak-connect

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nest-keycloak-connect - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

decorators/unprotected.decorator.d.ts

4

guards/auth.guard.d.ts
import { CanActivate, ExecutionContext } from '@nestjs/common';
import * as KeycloakConnect from 'keycloak-connect';
import { KeycloakConnectOptions } from '../interface/keycloak-connect-options.interface';
import { Reflector } from '@nestjs/core';
export declare class AuthGuard implements CanActivate {
private keycloak;
private keycloakOpts;
constructor(keycloak: KeycloakConnect.Keycloak, keycloakOpts: KeycloakConnectOptions);
private readonly reflector;
constructor(keycloak: KeycloakConnect.Keycloak, keycloakOpts: KeycloakConnectOptions, reflector: Reflector);
canActivate(context: ExecutionContext): Promise<boolean>;

@@ -9,0 +11,0 @@ extractJwt(headers: {

@@ -34,6 +34,9 @@ "use strict";

const constants_1 = require("../constants");
const core_1 = require("@nestjs/core");
const unprotected_decorator_1 = require("../decorators/unprotected.decorator");
let AuthGuard = class AuthGuard {
constructor(keycloak, keycloakOpts) {
constructor(keycloak, keycloakOpts, reflector) {
this.keycloak = keycloak;
this.keycloakOpts = keycloakOpts;
this.reflector = reflector;
}

@@ -43,2 +46,6 @@ canActivate(context) {

return __awaiter(this, void 0, void 0, function* () {
const isUnprotected = this.reflector.get(unprotected_decorator_1.META_UNPROTECTED, context.getHandler());
if (isUnprotected) {
return true;
}
const request = context.switchToHttp().getRequest();

@@ -78,4 +85,4 @@ const jwt = (_a = this.extractJwtFromCookie(request.cookies)) !== null && _a !== void 0 ? _a : this.extractJwt(request.headers);

__param(1, common_1.Inject(constants_1.KEYCLOAK_CONNECT_OPTIONS)),
__metadata("design:paramtypes", [Object, Object])
__metadata("design:paramtypes", [Object, Object, core_1.Reflector])
], AuthGuard);
exports.AuthGuard = AuthGuard;

@@ -8,2 +8,3 @@ import { DynamicModule } from '@nestjs/common';

export * from './decorators/allow-any-role.decorator';
export * from './decorators/unprotected.decorator';
export * from './guards/auth.guard';

@@ -10,0 +11,0 @@ export * from './guards/resource.guard';

@@ -36,2 +36,3 @@ "use strict";

__export(require("./decorators/allow-any-role.decorator"));
__export(require("./decorators/unprotected.decorator"));
__export(require("./guards/auth.guard"));

@@ -38,0 +39,0 @@ __export(require("./guards/resource.guard"));

{
"name": "nest-keycloak-connect",
"version": "1.1.2",
"version": "1.2.0",
"description": "keycloak-nodejs-connect module for Nest",

@@ -5,0 +5,0 @@ "author": "John Joshua Ferrer <johnjoshuaferrer@disroot.org>",

@@ -87,3 +87,3 @@ # Nest Keycloak Connect

```typescript
import { Resource, Roles, Scopes, AllowAnyRole } from 'nest-keycloak-connect';
import { Resource, Roles, Scopes, AllowAnyRole, Unprotected, Public } from 'nest-keycloak-connect';
import { Controller, Get, Delete, Put, Post, Param } from '@nestjs/common';

@@ -98,4 +98,5 @@ import { Product } from './product';

// New in 1.2.0, allows you add unprotected/public routes
@Get()
@Scopes('View', 'View All')
@Unprotected() // Use `@Public` if the verb seems weird to you
async findAll() {

@@ -102,0 +103,0 @@ return await this.service.findAll();

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