@bluelibs/x-ui-i18n-bundle
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

BlueLibs APOLLO SECURITY BUNDLE



This bundle is to inject into the context the token read from the request and decoded to an userId via the SecurityBundle.

Installation

npm i -S @bluelibs/apollo-bundle @bluelibs/apollo-security-bundle
import { ApolloSecurityBundle } from "@bluelibs/apollo-security-bundle";

kernel.addBundle(
  new ApolloSecurityBundle({
    // options go here
  })
);

Options:

export interface IApolloSecurityBundleConfig {
  // All true by default
  support: {
    headers?: boolean,
    cookies?: boolean,
    websocket?: boolean,
  };
  // bluelibs-token is the default for all
  identifiers: {
    headers?: string,
    cookies?: string,
    // For websocket you have to send the connection params in order to work
    websocket?: string,
  };
}

Usage:

import { ISecurityContext } from "@bluelibs/apollo-security-bundle";

load({
  resolvers: {
    Query: {
      findMyPosts(_, args, context: ISecurityContext) {
        if (!context.userId) {
          // You can throw an error.
        }
      },
    },
  },
});

Support

This package is part of BlueLibs family. If you enjoy this work please show your support by starring the main package. If not, let us know what can we do to deserve it, our feedback form is here

Readme

Keywords

none

Package Sidebar

Install

npm i @bluelibs/x-ui-i18n-bundle

Weekly Downloads

193

Version

1.2.2

License

MIT

Unpacked Size

28.1 kB

Total Files

60

Last publish

Collaborators

  • theodordiaconu