Initializes a server and passport instance using BearerStrategy in Azure AD context.
import createServer from '@egomobile/http-server'import { initServerForAzureADBearerStrategy, withAzureADBearer } from '@egomobile/azuread-auth'const app = createServer()// by default, the following environment variables are used// which represent the options of BearerStrategy by// `passport-azure-ad` module://// - [required] AZURE_AD_CLIENT_ID => IBearerStrategyOption.clientID// - [required] AZURE_AD_IDENTITY_METADATA => IBearerStrategyOption.identityMetadata// - [optional] AZURE_AD_AUDIENCE => IBearerStrategyOption.audience// - [optional] AZURE_AD_IS_B2C => IBearerStrategyOption.isB2C// - [optional] AZURE_AD_LOGGING_LEVEL => IBearerStrategyOption.loggingLevel// - [optional] AZURE_AD_POLICY_NAME => IBearerStrategyOption.policyName// - [optional] AZURE_AD_VALIDATE_ISSUER => IBearerStrategyOption.validateIssuerinitServerForAzureADBearerStrategy(app)app.get('/', [withAzureADBearer()], async (request, response) => { // your code ...})app.listen() .then(() => console.log('Server now running on port ' + app.port)) .catch((err) => console.error(err))
The server instance to setup.
Optional
Custom options.
Generated using TypeDoc
Initializes a server and passport instance using BearerStrategy in Azure AD context.
Example