Function withAzureADBearer

  • Creates a new middleware, which checks if an Azure AD OAuth Token is valid or not, by using oauth-bearer stradegy.

    Example

    import createServer from '@egomobile/http-server'
    import { initServerForAzureADBearerStrategy, withAzureADBearer } from '@egomobile/azuread-auth'

    const app = createServer()

    initServerForAzureADBearerStrategy(app)

    // use middleware by `withAzureADBearer()` to validate and extract
    // bearer token by Azure AD instance
    app.get('/', [withAzureADBearer()], async (request, response) => {
    // at this point we have a value token here
    console.log('authInfo', request.authInfo)
    })

    app.listen()
    .then(() => console.log('Server now running on port ' + app.port))
    .catch((err) => console.error(err))

    Returns

    The new middleware.

    Parameters

    Returns HttpMiddleware

Generated using TypeDoc