Tag: adal

利用州/ customState和passport-azure-ad

我无法弄清楚customState的目的,如果/如何,我可以利用它来传递数据到返回的url。 具体而言,我希望在login后将用户路由回原来的位置。我想我可以将原始URL传递给参数customState并在返回URL POST customState其返回给我,但似乎是编码或可能换成不同的值。 这是我想要达到的: 匿名用户访问/page/protected需要authentication。 代码调用passport.authenticate ,然后redirect用户login。 用户/auth/oidc/return并返回到预先configuration的返回URL,例如: /auth/oidc/return 。 代码处理从表单提交数据中提取信息。 用户被引导回到/page/protected 。

如何使用OIDCStrategy检索的accessToken来遍历AzuregraphicsAPI?

我正在使用https://github.com/AzureAD/passport-azure-ad将nodejs应用程序与Azure AD集成。 我使用OIDCStrategy将用户login到我的node.js应用程序中。 这是我的代码: (passport.use(new OIDCStrategy({ callbackURL: config.azureadCreds.callbackURL, realm: config.azureadCreds.realm, clientID: config.azureadCreds.clientID, clientSecret: config.azureadCreds.clientSecret, scope: "openid offline_access profile Directory.Read UserProfile.Read", identityMetadata: config.azureadCreds.identityMetadata, skipUserProfile: config.azureadCreds.skipUserProfile, responseType: config.azureadCreds.responseType, responseMode: config.azureadCreds.responseMode, passReqToCallback: true }, function (iss, sub, profile, claims, accessToken, refreshToken, params, done) { request.get("https://graph.windows.net/<my-tenant-id>/me?api-version=1.5", { 'headers': { 'Authorization': "Bearer " + params["id_token"], 'Content-Type': 'application/json' } }, function(err, […]

如何模拟服务的用户令牌服务调用

我的应用程序结构是Web应用程序调用一个WebAPI(让我们称之为apiA),并调用另一个API(让我们称之为apiB)。 现在,Web应用程序通过AAD JWT令牌对呼叫进行身份validation。 所以,这个标记将为apiA创build。 但我想api调用apiB作为login用户,并不想使用客户端的秘密等 所以,简而言之,就是要模拟用户,并从为apiA创build的令牌获取apiB的标记,或者可能有一个令牌,这对apiA和apiB都有好处。 所以,我不必得到一个新的令牌。 有没有办法做到这一点?

使用passport-azure-ad OIDCStrategy与Passportjs时遇到问题

我正在尝试使用passport-azure-ad来validation用户身份。 该应用程序显示常见的login屏幕,但当我login,浏览器窗口变为空白,并显示一个微调指示其工作。 与此同时,我的服务器正在接收连续的POST请求到我的callbackterminal。 在此期间,我的护照function(validation,serializeUser和deserializeUser)都不会被调用。 这里是我的战略定义: passport.use("azure", new azureStrategy({ identityMetadata: 'https://login.microsoftonline.com/common/.well-known/openid-configuration', clientID: "*************************", responseType: 'code id_token', issuer: "https://sts.windows.net/********************/", responseMode: 'form_post', redirectUrl: "http://localhost:5055/auth/azure/callback", allowHttpForRedirectUrl: true, clientSecret: "**********************************" }, function(iss, sub, profile, accessToken, refreshToken, done) { console.log("ID TOken: ", profile.oid); //Never gets called console.log("User" ,profile) //Never gets called done(null, profile); })); passport.serializeUser(function(user, done){ console.log("serialize: ", user) //Never gets […]

找不到模块:错误:无法parsing模块“fs”中

我正在尝试整合ADAL JS示例代码: https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/master/sample/client-credentials-sample.js 到一个SharePoint的框架客户端Web部件: 我的代码非常简单,我已经安装了NPM,adal,fs,node-fs等。 However I see this error ./~/adal-node/lib/util.js Module not found: Error: Cannot resolve module 'fs' in /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib resolve module fs in /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib looking for modules in /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib/fs doesn't exist (module as directory) resolve 'file' fs in /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib resolve file 我的代码是这样的: 我什至评论要求的JS线,但它看起来像adal js库本身使用FS似乎没有正确安装? import { BaseClientSideWebPart, IPropertyPaneSettings, IWebPartContext, PropertyPaneTextField } from […]

使用Node.js Passport的Azure AD身份validation返回“此API版本不支持”

我目前正在开发一个使用Azure AD进行身份validation的应用程序。 应用程序应支持多个租户,但只有预定义的租户列表才能访问应用程序。 使用passport-azure-ad库,我将OIDCStrategy添加到护照中,如下所示: // Use Azure AD OAuth2 strategy. passport.use('strategyName', new OIDCStrategy({ callbackURL: 'http://localhost:8080/oauth2/strategyName/callback', clientID: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', clientSecret: 'secret', identityMetadata: 'https://login.microsoftonline.com/test.mydomain.com/v2.0/.well-known/openid-configuration', responseType: 'id_token', responseMode: 'form_post', skipUserProfile: true }, function (iss, sub, profile, accessToken, refreshToken, done) { console.log(profile); done(); })); 在我的路线上,我有以下设置: // Authentication endpoint. router.get('/strategyName', app.passport.authenticate('strategyName')); router.post('/strategyName/callback', function (req, res, next) { app.passport.authenticate('strategyName', function (err, account) […]