close

IDE:2019

Core:3.1

參考網址:連結1  /  連結2 


終於把問題二給解決了,當有驗證使用者,使用了AntiforgeryToken,容易登入失敗

在自己的電腦,自己的測試機,甚至於用到Azure都沒問題!?

可是偏偏放到GAE後,就有這個很奇特的問題發生?

如果增加了[Authorize]後,更是容易導回登入頁面??

終於找到解決的關鍵字了,可以看看參考網址,有說明為什麼

這篇文章記錄著解決的方式,如果只想快速解決,可以參考看看


首先Google Cloud Storage Bucket新增Keyring 和 Key

gcloud kms keyrings create dataprotectionprovider --location global
gcloud kms keys create key --location global --keyring dataprotectionprovider --purpose=encryption

設定使用帳戶

gcloud kms keyrings add-iam-policy-binding dataprotectionprovider --location global  --member serviceAccount:my-project-id@appspot.gserviceaccount.com  --role roles/cloudkms.cryptoKeyEncrypterDecrypter

紅字為你的專案ID


專案要新增兩個dll

目前好像只有開發版,但至少能解決

Google.Cloud.AspNetCore.DataProtection.Kms
Google.Cloud.AspNetCore.DataProtection.Storage

appsettings.json增加

image

 "Bucket": "sample-286901.appspot.com",
 "Object": "DataProtectionProviderKeys.xml",
 "KmsKeyName": "projects/sample-286901/locations/global/keyRings/dataprotectionprovider/cryptoKeys/key"

Bucket:是儲存桶名稱

KmsKeyName:那邊輸入專案ID

image

Startup.cscs增加

image

最主要的就是這兩個,其他就跟正常身分授權的方式一樣

arrow
arrow

    軒軒的爸媽 發表在 痞客邦 留言(0) 人氣()