第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

配置授權(quán)服務(wù)器端點(diǎn)

配置授權(quán)服務(wù)器端點(diǎn)

拉莫斯之舞 2019-09-20 16:58:39
題我們?nèi)绾问褂糜脩裘兔艽a流在ASP.NET 5中使用持票令牌?對(duì)于我們的場(chǎng)景,我們希望讓用戶使用AJAX調(diào)用進(jìn)行注冊(cè)和登錄,而無需使用外部登錄。為此,我們需要一個(gè)授權(quán)服務(wù)器端點(diǎn)。在以前的ASP.NET版本中,我們將執(zhí)行以下操作,然后在ourdomain.com/TokenURL上登錄。// Configure the application for OAuth based flowPublicClientId = "self";OAuthOptions = new OAuthAuthorizationServerOptions{    TokenEndpointPath = new PathString("/Token"),    Provider = new ApplicationOAuthProvider(PublicClientId),    AccessTokenExpireTimeSpan = TimeSpan.FromDays(14)};但是,在當(dāng)前版本的ASP.NET中,上述操作無效。我們一直試圖找出新的方法。例如,GitHub上的aspnet / identity示例配置了Facebook,Google和Twitter身份驗(yàn)證,但似乎沒有配置非外部OAuth授權(quán)服務(wù)器端點(diǎn),除非這樣AddDefaultTokenProviders()做,在這種情況下我們想知道到底是什么URL提供者會(huì)。研究我們從閱讀源代碼中了解到,我們可以通過調(diào)用IAppBuilder.UseOAuthBearerAuthentication我們的Startup類來向HTTP管道添加“承載認(rèn)證中間件” 。雖然我們?nèi)匀徊淮_定如何設(shè)置其令牌端點(diǎn),但這是一個(gè)良好的開端。這不起作用:public void Configure(IApplicationBuilder app){      app.UseOAuthBearerAuthentication(options =>    {        options.MetadataAddress = "meta";    });    // if this isn't here, we just get a 404    app.Run(async context =>    {        await context.Response.WriteAsync("Hello World.");    });}要去ourdomain.com/meta我們剛剛收到我們的Hello World頁面。進(jìn)一步的研究表明,我們也可以使用IAppBuilder.UseOAuthAuthentication擴(kuò)展方法,并且它需要一個(gè)OAuthAuthenticationOptions參數(shù)。該參數(shù)具有TokenEndpoint屬性。因此,雖然我們不確定我們?cè)谧鍪裁矗覀儑L試了這一點(diǎn),當(dāng)然這不起作用。public void Configure(IApplicationBuilder app){    app.UseOAuthAuthentication("What is this?", options =>    {        options.TokenEndpoint = "/token";        options.AuthorizationEndpoint = "/oauth";        options.ClientId = "What is this?";        options.ClientSecret = "What is this?";        options.SignInScheme = "What is this?";        options.AutomaticAuthentication = true;    });    // if this isn't here, we just get a 404    app.Run(async context =>    {        await context.Response.WriteAsync("Hello World.");    });}換句話說,在去ourdomain.com/token,沒有錯(cuò)誤,只有我們的問候世界頁面。
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 704 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)