string SignL1(ApiUtilLib.HttpMethod httpMethod) { var authPrefix = _type == GatewayType.PROXY ? "Apex_l1_eg" : "Apex_l1_ig"; return(ApiAuthorization.Token(realm: _realm, authPrefix: authPrefix, httpMethod: httpMethod, urlPath: new Uri(_signingUrlPath), appId: _appId, secret: _appSecret)); }
public string GetSignature(ApiUtilLib.HttpMethod httpMethod) { if (string.IsNullOrEmpty(_auth)) { return(""); } return(_auth.ToUpper() == "L2" ? SignL2(httpMethod) : SignL1(httpMethod)); }
string SignL2(ApiUtilLib.HttpMethod httpMethod) { var authPrefix = _type == GatewayType.PROXY ? "Apex_l2_eg" : "Apex_l2_ig"; var path = GetLocalPath(_certFileName); var privateKey = ApiAuthorization.PrivateKeyFromP12(path, _certPassPhrase); return(ApiAuthorization.Token(realm: _realm, authPrefix: authPrefix, httpMethod: httpMethod, urlPath: new Uri(_signingUrlPath), appId: _appId, privateKey: privateKey)); }
static MCHelper GetMCHelper(string endpoint, ApiUtilLib.HttpMethod httpMethod) { var proxy = new Gateway(_settings, GatewayType.PROXY, "L2", signingUrlPath: $"{_proxySigningHost}{endpoint}", targetUrlPath: $"{_proxyTargetHost}{endpoint}"); var source = new Gateway(_settings, GatewayType.SOURCE, "L1", signingUrlPath: $"{_sourceSigningHost}{endpoint}", targetUrlPath: $"{_sourceTargetHost}{endpoint}"); return(new MCHelper(GatewayType.PROXY, proxy, source, httpMethod)); }