Skip to content

Commit e27946a

Browse files
committed
Merge remote-tracking branch 'valeriomazzeo/patch-2'
See auth0-samples#8
2 parents f9e7f29 + b5e79e1 commit e27946a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ const jwksClient = require('jwks-rsa');
44
const jwt = require('jsonwebtoken');
55
const util = require('util');
66

7-
const getPolicyDocument = (effect, resource) => {
7+
const getPolicyDocument = (effect, methodArn) => {
8+
9+
// parse the ARN from the incoming resource
10+
var methodArnComponents = methodArn.split(':');
11+
var apiOptions = methodArnComponents[5].split('/');
12+
methodArnComponents[5] = [apiOptions[0], apiOptions[1], "*"].join('/');
13+
var resource = methodArnComponents.join(':');
14+
815
const policyDocument = {
916
Version: '2012-10-17', // default version
1017
Statement: [{

0 commit comments

Comments
 (0)