Class ValidPlatformAttribute
平台驗證標籤,加上該標籤的 Action 都會進行平台驗證檢查,檢查失敗將回傳 401 Unauthorized,且不會進入 Action
public class ValidPlatformAttribute : AuthorizeAttribute, _Attribute, IAuthorizationFilter, IFilter
- Inheritance
-
ValidPlatformAttribute
- Implements
- Inherited Members
Methods
IsVaild(string, string, string, string)
內對內 API 驗證平台是否可被信任
public bool IsVaild(string content, string IV, string Authorization, string OuterSignature)
Parameters
contentstringHTTP Request.Content 字串內容
IVstring加密種子
Authorizationstring以 Signature + Iv + 系統金鑰 使用 DES 雜湊後的結果
OuterSignaturestring簽章,將傳送的資料以 MD5 加密後的字串
Returns
- bool
這個請求是否可被信任
OnAuthorization(HttpActionContext)
Web API 進入 Action 會執行這個方法驗證
public override void OnAuthorization(HttpActionContext actionContext)
Parameters
actionContextHttpActionContextWebAPI HttpActionContext