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

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Dara Hayes committed May 16, 2019
1 parent 1431b6a commit 77299e0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/voyager-keycloak/src/KeycloakSecurityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ export class KeycloakSecurityService implements SecurityService {
}

public async onSubscriptionConnect(connectionParams: any, webSocket: any, context: any): Promise<any> {
let header = connectionParams.Authorization
const header = connectionParams.Authorization
|| connectionParams.authorization
|| connectionParams.Auth
|| connectionParams.Auth
|| connectionParams.auth
if (!header) {
throw new Error('Access Denied - missing Authorization field in connection parameters')
Expand Down
4 changes: 2 additions & 2 deletions packages/voyager-keycloak/src/api/SecurityService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ export interface SecurityService {

/**
* onSubscriptionConnect is called when a client opens a websocket connection
* for a GraphQL subscription. Anything returned from this function is added
* for a GraphQL subscription. Anything returned from this function is added
* to the context within subscription resolvers
* The main use case here is auth. Example - we could parse and validate a token
* from the connectionParams and return a user object. Now this object is accessible
* Within the subscription context.
* Apollo docs: https://www.apollographql.com/docs/graphql-subscriptions/authentication
*
*
* @param connectionParams connection parameters provided by the websocket client
* @param webSocket The websocket object
* @param context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export class VoyagerSubscriptionContextProvider {
constructor(config: VoyagerSubscriptionServerOptions) {
this.config = config


if (typeof this.config.onConnect === 'function') {
this.userOnConnectFunction = this.config.onConnect
} else if (isObject(this.config.onConnect)) {
Expand Down Expand Up @@ -71,4 +70,4 @@ export class VoyagerSubscriptionContextProvider {
function isObject(val: any) {
if (val === null) { return false }
return (typeof val === 'object' && !Array.isArray(val))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ export function createSubscriptionServer(options: VoyagerSubscriptionServerOptio

const serverOptions = { ...userServerOptions, ...defaultServerOptions, onConnect: subscriptionContextProvider.getOnConnectFunction() }
return new SubscriptionServer(serverOptions, socketOptionsOrServer)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ import { SecurityService } from '@aerogear/voyager-keycloak'

export interface VoyagerSubscriptionServerOptions extends ServerOptions {
securityService: SecurityService
}
}
2 changes: 1 addition & 1 deletion packages/voyager-subscriptions/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './VoyagerSubscriptionServerOptions'
export * from './VoyagerSubscriptionServerOptions'

0 comments on commit 77299e0

Please sign in to comment.