- Create the project from the following template:
$ sls create --template-url https://github.com/danteinc/js-cloud-native-cookbook/tree/master/ch6/feature-flag --path cncb-feature-flag
- Navigate to the cncb-feature-flag directory with cd cncb-feature-flag.
- Review the file named src/Authorize.js, as follows:
...const getGroups = props => get(props, 'auth.cognito.signInUserSession.idToken.payload.cognito:groups', '');const check = (allowedRoles, props) => { const groups = getGroups(props); return intersection(groups, allowedRoles).length > 0;};const HasRole = allowedRoles => props => check(allowedRoles, props) ? props.children : null;export const HasAuthorRole = HasRole(['Author']);export const HasBetaUserRole = HasRole ...