How to use the unleash-server.AuthenticationRequired function in unleash-server

To help you get started, we’ve selected a few unleash-server examples, based on popular ways it is used in public projects.

github kindlyops / havengrc / unleash / keycloak-auth-hook.js View on Github external
app.use('/api/admin/', (req, res, next) => {
        if (req.user) {
            next();
        } else {
            // Instruct unleash-frontend to pop-up auth dialog
            return res
                .status('401')
                .json(
                    new AuthenticationRequired({
                        path: '/unleash/api/admin/login',
                        type: 'custom',
                        message: `You have to identify yourself in order to use Unleash. 
                        Click the button and follow the instructions.`,
                    })
                )
                .end();
        }
    });
}
github kindlyops / havengrc / unleash / google-auth-hook.js View on Github external
app.use('/api/admin/', (req, res, next) => {
        if (req.user) {
            next();
        } else {
            // Instruct unleash-frontend to pop-up auth dialog
            return res
                .status('401')
                .json(
                    new AuthenticationRequired({
                        path: '/api/admin/login',
                        type: 'custom',
                        message: `You have to identify yourself in order to use Unleash. 
                        Click the button and follow the instructions.`,
                    })
                )
                .end();
        }
    });
}

unleash-server

Unleash is an enterprise ready feature toggles service. It provides different strategies for handling feature toggles.

Apache-2.0
Latest version published 3 days ago

Package Health Score

93 / 100
Full package analysis