2017-08-08 47 views
0

指:https://github.com/Azure-Samples/active-directory-node-webapi在GitHub上正确配置config.js“保护与Azure的AD网络API”

我创建需要使用我公司的Azure Active Directory进行身份验证的用户展示一个简单的POC的应用程序。我遵循了read.me中的所有步骤,并陷入了第6步:使用config.js配置您的服务器。

在该部分中,作者写道:“您将需要更新示例以将您的值用于元数据端点。”我知道我的租户和客户端ID的值。我只是不确定我需要在config.js中进行更新。

我将clientID添加到配置对象中,但节点返回时出现clientID不能为空的错误。我不确定我应该把这个放在哪里。

下面是获取传递给app.js对象:

 // Don't commit this file to your public repos. This config is for first-run 
exports.creds = { 
    mongoose_auth_local: 'mongodb://localhost/tasklist', // Your mongo auth uri goes here 
    identityMetadata: 'https://login.microsoftonline.com/093b18fb-a101-4e60-a38e-3a4af975a32e/.well-known/openid-configuration', // This is customized for your tenant. 
    tenant : "retailsolutions.com", 
    clientID : "093b18fb-a101-4e60-a38e-3a4af975a32e", 
    // You may use the common endpoint for multi-tenant scenarios 
    // if you do, make sure you set validateIssuer to false and specify an audience 
    // as you won't get this from the Identity Metadata 
    // 
    //identityMetadata: 'https://login.microsoftonline.com/common/.well-known/openid-configuration', 
    validateIssuer: true, // if you have validation on, you cannot have users from multiple tenants sign in 
    passReqToCallback: false, 
    loggingLevel: 'info' // valid are 'info', 'warn', 'error'. Error always goes to stderr in Unix. 
}; 

有没有可能有人谁拥有了经验,这提供了一个很好的例子吗?谢谢!

回答

0

您将需要设置在options客户端ID被传递给护照库如下:

var options = { 
... 
clientID: config.creds.clientID, 
... 
}