Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fix: use keycloak-connect-graphql@0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Dara Hayes committed Jul 17, 2019
1 parent ff8e802 commit edb1edc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/voyager-keycloak/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"dependencies": {
"express-session": "1.16.2",
"keycloak-connect": "6.0.1",
"keycloak-connect-graphql": "0.1.1"
"keycloak-connect-graphql": "0.2.1"
},
"devDependencies": {
"@types/express": "^4.17.0",
Expand Down
18 changes: 18 additions & 0 deletions packages/voyager-keycloak/test/KeycloakSecurityService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { KeycloakSecurityService } from '../src/KeycloakSecurityService'

test('onSubscriptionConnect throws if no connectionParams Provided', async t => {
const stubKeycloak = {
config: {
clientId: 'voyager-testing',
},
grantManager: {
validateToken: (token: string, type: 'string') => {
return new Promise((resolve, reject) => {
Expand All @@ -22,6 +25,9 @@ test('onSubscriptionConnect throws if no connectionParams Provided', async t =>

test('onSubscriptionConnect throws if no connectionParams is not an object', async t => {
const stubKeycloak = {
config: {
clientId: 'voyager-testing',
},
grantManager: {
validateToken: (token: string, type: 'string') => {
return new Promise((resolve, reject) => {
Expand All @@ -41,6 +47,9 @@ test('onSubscriptionConnect throws if no connectionParams is not an object', asy

test('onSubscriptionConnect throws if no Auth provided', async t => {
const stubKeycloak = {
config: {
clientId: 'voyager-testing',
},
grantManager: {
validateToken: (token: string, type: 'string') => {
return new Promise((resolve, reject) => {
Expand All @@ -60,6 +69,9 @@ test('onSubscriptionConnect throws if no Auth provided', async t => {

test('onSubscriptionConnect returns a token Object if the keycloak library considers it valid', async t => {
const stubKeycloak = {
config: {
clientId: 'voyager-testing',
},
grantManager: {
validateToken: (token: string, type: 'string') => {
return new Promise((resolve, reject) => {
Expand All @@ -80,6 +92,9 @@ test('onSubscriptionConnect returns a token Object if the keycloak library consi

test('the token object will have hasRole, hasRealmRole and hasPermissions if the', async t => {
const stubKeycloak = {
config: {
clientId: 'voyager-testing',
},
grantManager: {
validateToken: (token: string, type: 'string') => {
return new Promise((resolve, reject) => {
Expand All @@ -103,6 +118,9 @@ test('the token object will have hasRole, hasRealmRole and hasPermissions if the
test('If the keycloak token validation fails, then onSubscriptionConnect will throw', async t => {
const errorMsg = 'token is invalid'
const stubKeycloak = {
config: {
clientId: 'voyager-testing',
},
grantManager: {
validateToken: (token: string, type: 'string') => {
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit edb1edc

Please sign in to comment.