Preserve path bases in Member Center endpoint configuration
This commit is contained in:
parent
bb219fcbb3
commit
ea6507c9eb
@ -184,6 +184,8 @@ docker run --rm -p 8080:8080 \
|
|||||||
|
|
||||||
`MemberCenter__BaseUrl` 則是 Agent 呼叫 `/oauth/token` 與 delegated download token validation endpoint 的 server-to-server base URL,可依部署網路使用內網位址。
|
`MemberCenter__BaseUrl` 則是 Agent 呼叫 `/oauth/token` 與 delegated download token validation endpoint 的 server-to-server base URL,可依部署網路使用內網位址。
|
||||||
|
|
||||||
|
若 `MemberCenter__BaseUrl` 含有 path base(例如 `https://member.example.com/api/`),`MemberCenter__TokenEndpointPath` 與 `MemberCenter__DownloadTokenValidationPath` 請使用不以 `/` 開頭的相對路徑,例如 `oauth/token`、`file-access/download-tokens/validate`,避免 HttpClient 組 URL 時把 `/api/` 丟掉。
|
||||||
|
|
||||||
若使用 local storage,建議掛載 volume,避免 container 移除後檔案遺失:
|
若使用 local storage,建議掛載 volume,避免 container 移除後檔案遺失:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -247,6 +249,8 @@ docker run --rm -p 8080:8080 \
|
|||||||
- `MemberCenter:ServiceClientId`(file_api)
|
- `MemberCenter:ServiceClientId`(file_api)
|
||||||
- `MemberCenter:ServiceClientSecret`(file_api)
|
- `MemberCenter:ServiceClientSecret`(file_api)
|
||||||
- `MemberCenter:ServiceScopes`(至少 `files:upload.write files:metadata.read files:delete files:download.delegate`)
|
- `MemberCenter:ServiceScopes`(至少 `files:upload.write files:metadata.read files:delete files:download.delegate`)
|
||||||
|
- `MemberCenter:ServiceTokenEndpointPath`(預設 `oauth/token`;若 `Authority` 含 `/api/` 這類 path base,請使用不以 `/` 開頭的相對路徑)
|
||||||
|
- `MemberCenter:DelegatedDownloadTokenEndpointPath`(預設 `file-access/download-tokens`;同上,建議使用相對路徑)
|
||||||
- `FileAccessAgent:BaseUrl`
|
- `FileAccessAgent:BaseUrl`
|
||||||
- `FileAccessAgent:TenantId`
|
- `FileAccessAgent:TenantId`
|
||||||
|
|
||||||
|
|||||||
@ -28,8 +28,8 @@
|
|||||||
},
|
},
|
||||||
"MemberCenter": {
|
"MemberCenter": {
|
||||||
"BaseUrl": "http://localhost:7850/",
|
"BaseUrl": "http://localhost:7850/",
|
||||||
"TokenEndpointPath": "/oauth/token",
|
"TokenEndpointPath": "oauth/token",
|
||||||
"DownloadTokenValidationPath": "/file-access/download-tokens/validate",
|
"DownloadTokenValidationPath": "file-access/download-tokens/validate",
|
||||||
"ClientId": "f3806ab779d2440d8ff8f26aa01e995d",
|
"ClientId": "f3806ab779d2440d8ff8f26aa01e995d",
|
||||||
"ClientSecret": "P5myv2PmFlKBNR7ke+zrmjmTpV+ob/53VBtOHRMfXTU=",
|
"ClientSecret": "P5myv2PmFlKBNR7ke+zrmjmTpV+ob/53VBtOHRMfXTU=",
|
||||||
"Scope": "files:download.read"
|
"Scope": "files:download.read"
|
||||||
|
|||||||
@ -5,8 +5,8 @@ public sealed class MemberCenterOptions
|
|||||||
public const string SectionName = "MemberCenter";
|
public const string SectionName = "MemberCenter";
|
||||||
|
|
||||||
public string BaseUrl { get; set; } = "http://localhost:7850";
|
public string BaseUrl { get; set; } = "http://localhost:7850";
|
||||||
public string TokenEndpointPath { get; set; } = "/oauth/token";
|
public string TokenEndpointPath { get; set; } = "oauth/token";
|
||||||
public string DownloadTokenValidationPath { get; set; } = "/file-access/download-tokens/validate";
|
public string DownloadTokenValidationPath { get; set; } = "file-access/download-tokens/validate";
|
||||||
public string ClientId { get; set; } = string.Empty;
|
public string ClientId { get; set; } = string.Empty;
|
||||||
public string ClientSecret { get; set; } = string.Empty;
|
public string ClientSecret { get; set; } = string.Empty;
|
||||||
public string Scope { get; set; } = "files:download.read";
|
public string Scope { get; set; } = "files:download.read";
|
||||||
|
|||||||
@ -445,7 +445,10 @@ public class HomeController : Controller
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var response = await client.PostAsJsonAsync("/file-access/download-tokens", payload, HttpContext.RequestAborted);
|
using var response = await client.PostAsJsonAsync(
|
||||||
|
_authOptions.DelegatedDownloadTokenEndpointPath,
|
||||||
|
payload,
|
||||||
|
HttpContext.RequestAborted);
|
||||||
var body = await response.Content.ReadAsStringAsync(HttpContext.RequestAborted);
|
var body = await response.Content.ReadAsStringAsync(HttpContext.RequestAborted);
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,5 +17,6 @@ public sealed class TestSiteAuthOptions
|
|||||||
public string ServiceClientId { get; set; } = string.Empty; // file_api client
|
public string ServiceClientId { get; set; } = string.Empty; // file_api client
|
||||||
public string ServiceClientSecret { get; set; } = string.Empty;
|
public string ServiceClientSecret { get; set; } = string.Empty;
|
||||||
public string ServiceScopes { get; set; } = "files:upload.write files:metadata.read files:delete files:download.delegate";
|
public string ServiceScopes { get; set; } = "files:upload.write files:metadata.read files:delete files:download.delegate";
|
||||||
public string ServiceTokenEndpointPath { get; set; } = "/oauth/token";
|
public string ServiceTokenEndpointPath { get; set; } = "oauth/token";
|
||||||
|
public string DelegatedDownloadTokenEndpointPath { get; set; } = "file-access/download-tokens";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user