1.1.0 • Published 4 years ago

@tessaroto/graphql-security v1.1.0

Weekly downloads
18
License
-
Repository
github
Last release
4 years ago

Security Module for GraphQL

Example

Installing module

$ npm install security-graphql --save    

Configuration

Example

const config = {
	"basic": {
		"username": "services",
		"password": "123456"
	},
	"bearer": {
		"keycloak_url": "http://localhost:8080",
		"realm": "MyDemo",
		"client_id": "my-react-client",
		"cache":{
			"cert_ttl": 10000,
			"cert_stale_ttl": 100000,
			"cert_stale_short_ttl": 1000
		}
	}
}

const protect = new Security(config);

Properties

ElementDescriptionDefault
basicFor use basic authentication, this is optional
basic.usernameUsername of basic auth
basic.passwordPassword of basic auth
bearerFor use bearer authentication, this is optional
bearer.keycloak_urlUrl of Keycloak
bearer.realmRealm of Keycloak
bearer.client_idClient Id of application that is configured in keycloak
bearer.cacheCache options, this is optional but if not defined will be using defaults values
bearer.cache.cert_ttlTTL of certification cache10 min
bearer.cache.cert_stale_ttlTTL of certification stale cache1 day
bearer.cache.cert_stale_short_ttl1 min