我们正在我们的网站上显示来自Facebook的供稿.直到昨天,我们才能使用以下网址以JSON格式检索Feed:
https://www.facebook.com/feeds/page.php?format=json&id=[id_of_the_page]
Run Code Online (Sandbox Code Playgroud)
但今天我发现这个链接已被破坏.有没有理由让它破裂?
有没有办法可以使用新的Graph API访问我的页面的JSON提要?
我正在处理的项目涉及从配置文件中读取许多服务端点(url).由于列表非常大,我决定将它们保存在自定义配置文件中,以保持web.config干净小巧.我将自定义部分包含在我的网站中,如下所示:
<mySection configSource="myConfig.config" />
Run Code Online (Sandbox Code Playgroud)
我工作得很好.
但是在将项目部署到不同环境期间出现了转换问题.我有三个web.config文件:
Web.config文件
Web.Uat.config
Web.Release.config
转换web.config工作时,自定义配置文件的转换在部署时失败.
有没有办法在部署期间转换自定义配置文件?
我们开发了一组受授权服务器保护的Web API(REST).授权服务器已发出客户端ID和客户端密钥.这些可用于获取访问令牌.可以在后续对资源服务器(REST API)的调用中使用有效令牌.
我想编写一个基于Web的(Asp.net MVC 5)客户端,它将使用API.我可以下载一个nuget包来帮助我实现客户端OAuth2流吗?任何人都可以指导我在OAuth2流的客户端实现(用asp.net MVC编写)中的一个很好的例子吗?
更新 我能够使用下面的代码块获取访问令牌,但我想要的是"客户端凭据"oauth 2流程,我不必输入登录名和密码.我现在的代码是:
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType("ClientCookie");
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
AuthenticationType = "ClientCookie",
CookieName = CookieAuthenticationDefaults.CookiePrefix + "ClientCookie",
ExpireTimeSpan = TimeSpan.FromMinutes(5)
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
AuthenticationType = OpenIdConnectAuthenticationDefaults.AuthenticationType,
SignInAsAuthenticationType = app.GetDefaultSignInAsAuthenticationType(),
ClientId = ConfigurationManager.AppSettings["AuthServer:ClientId"],
ClientSecret = ConfigurationManager.AppSettings["AuthServer:ClientSecret"],
RedirectUri = ConfigurationManager.AppSettings["AuthServer:RedirectUrl"],
Configuration = new OpenIdConnectConfiguration
{
AuthorizationEndpoint = "https://identityserver.com/oauth2/authorize",
TokenEndpoint = "https://identityserver.com/oauth2/token"
},
//ResponseType = "client_credentials", // Doesn't work
ResponseType = "token", …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个项目,其中第三方提供商将充当基于Oauth2的授权服务器.一个基于Asp.net MVC 5的客户端,它将用户发送给授权服务器进行身份验证(使用登录/密码),auth服务器将一个访问令牌返回给MVC客户端.将使用访问令牌对资源服务器(API)进行任何进一步调用.
为此,我使用的是Microsoft.Owin.Security.OpenIdConnect和UseOpenIdConnectAuthentication扩展.我能够成功重定向并从auth服务器获取访问令牌,但客户端没有创建身份验证Cookie.每次我尝试访问安全页面时,都会获得带有访问令牌的回调页面.
我在这里错过了什么?我目前的代码如下.
安全控制器动作:
namespace MvcWebApp.Controllers
{
public class SecuredController : Controller
{
// GET: Secured
[Authorize]
public ActionResult Index()
{
return View((User as ClaimsPrincipal).Claims);
}
}
}
Run Code Online (Sandbox Code Playgroud)
启动类:
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType("ClientCookie");
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
AuthenticationType = "ClientCookie",
CookieName = CookieAuthenticationDefaults.CookiePrefix + "ClientCookie",
ExpireTimeSpan = TimeSpan.FromMinutes(5)
});
// ***************************************************************************
// Approach 1 : ResponseType = "id_token token"
// ***************************************************************************
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
AuthenticationType = OpenIdConnectAuthenticationDefaults.AuthenticationType, …
Run Code Online (Sandbox Code Playgroud) 一旦用户使用Dotnet Core MVC应用程序上的OpenID Connect进行身份验证,我试图找出运行某些代码的最佳方法.我不想在登录后对重定向URL进行硬编码,因为他们仍然需要在验证后尝试访问的地方结束.我只需要运行代码,例如."检查它是否第一次登录并设置标志"或类似的东西.
我使用的是中间件,但是因为每个请求都会调用它而导致一些问题.
有没有人对如何实现这一点有任何想法?
authentication asp.net-mvc openid-connect .net-core identityserver3
我正在使用 owin openid connect 身份验证,其中身份验证提供程序托管在单独的域上。身份验证过程运行良好。在身份服务器成功登录后,我能够查看受限页面。
但我希望外部身份服务器返回到“account/SignInCallback”控制器操作,以便我可以执行与成员帐户相关的几行代码。在浏览器的网络活动中,它向我显示“account/SignInCallback”的“302 Found”,但它没有命中附加的断点。它直接转到请求发起 URL,例如“帐户/仪表板”。
有没有办法可以强制系统在登录后返回特定的网址,即使请求的网址不同?
public class AccountController : BaseController
{
public AccountController() : base()
{
}
[Authorize]
public ActionResult Dashboard()
{
return View();
}
[HttpPost]
[AllowAnonymous]
public ActionResult SignInCallback()
{
if (User.Identity.IsAuthenticated)
{
// Read claims and execute member specific codes
}
return View();
}
[AllowAnonymous]
public ActionResult Unauthorized()
{
return View();
}
}
Run Code Online (Sandbox Code Playgroud)
启动类如下:
public sealed class Startup
{
public void Configuration(IAppBuilder app)
{
string ClientCallbackUri = @"https://client.local/account/SignInCallback";
string IdServBaseUri = @"https://idm.website.com/core";
string TokenEndpoint …
Run Code Online (Sandbox Code Playgroud) 我正在尝试为 Kendo UI 网格实现服务器端过滤(仅限客户端)。我不确定如何传递过滤器运算符和在过滤器框中输入的值。我能够实现服务器分页,并希望过滤与服务器分页一起工作,即显示已过滤行的 5 个项目的第 2 页。我看到了一些将请求绑定到“DataSourceRequest”对象的示例,但我们没有服务器端 Kendo UI 的许可证,只能使用客户端更改来实现它。
这是我的 jQuery 代码:
var page = 1;
var pageSize = 5;
var title = "test";
var selectWork = function (e) {
alert("selected");
};
$("#selectWorkGrid").empty();
$("#selectWorkGrid").kendoGrid({
dataSource:
{
transport: {
read: {
url: "http://example.com/" + "work/SearchWorkJ?worktitle=" + title,
dataType: "json",
contentType: "application/json",
data: {
page: page,
pageSize: pageSize
}
},
serverFiltering: true,
parameterMap: function (data, type) {
if (type == "read") {
return {
page: data.page,
pageSize: data.pageSize
}
} …
Run Code Online (Sandbox Code Playgroud) asp.net-mvc ×4
asp.net ×3
c# ×3
oauth-2.0 ×2
owin ×2
.net-core ×1
asp.net-ajax ×1
facebook ×1
katana ×1
kendo-grid ×1
kendo-ui ×1
webdeploy ×1
wso2 ×1