2.2.0-oc.3 • Published 4 months ago

@opencreek/neo4j-graphql-plugin-auth v2.2.0-oc.3

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
4 months ago

@neo4j/graphql-plugin-auth

Auth decode plugins for @neo4j/graphql

  1. Documentation

Installation

$ npm install @neo4j/graphql-plugin-auth

Usage

Neo4jGraphQLAuthJWTPlugin

import { Neo4jGraphQL } from "@neo4j/graphql";
import { Neo4jGraphQLAuthJWTPlugin } from "@neo4j/graphql-plugin-auth";

const neoSchema = new Neo4jGraphQL({
    typeDefs,
    plugins: {
        auth: new Neo4jGraphQLAuthJWTPlugin({
            secret: "super-secret",
        }),
    },
});

// Or you can initiate the secret with a function which will run to retrieve the secret when the request comes in

const neoSchema = new Neo4jGraphQL({
    typeDefs,
    plugins: {
        auth: new Neo4jGraphQLAuthJWTPlugin({
            secret: (req) => {
                return "super-secret";
            },
        }),
    },
});

Neo4jGraphQLAuthJWKSPlugin

import { Neo4jGraphQL } from "@neo4j/graphql";
import { Neo4jGraphQLAuthJWKSPlugin } from "@neo4j/graphql-plugin-auth";

const neoSchema = new Neo4jGraphQL({
    typeDefs,
    plugins: {
        auth: new Neo4jGraphQLAuthJWKSPlugin({
            jwksEndpoint: "https://YOUR_DOMAIN/well-known/jwks.json",
        }),
    },
});

//Or you can pass a function as jskwsEndpoint to compute the endpoint when the request comes in.

const neoSchema = new Neo4jGraphQL({
    typeDefs,
    plugins: {
        auth: new Neo4jGraphQLAuthJWKSPlugin({
            jwksEndpoint: (req) => {
                let url = "https://YOUR_DOMAIN/well-known/{file}.json";
                const fileHeader = req.headers["file"];
                url = url.replace("{file}", fileHeader);
                return url;
            },
        }),
    },
});

Licence

Apache 2.0

2.2.0-oc.3

4 months ago

2.2.0-oc.0

6 months ago

2.2.0-oc.2

9 months ago

2.2.0-oc.1

10 months ago

3.23.1-oc.3

9 months ago

3.0.0-alpha.1

1 year ago

2.0.0-alpha

1 year ago

1.0.0

2 years ago

1.0.1-alpha.3

2 years ago

1.0.0-alpha.3

2 years ago

1.0.0-alpha.2

2 years ago