runtime.csharp.IRT.Transport.Authorization.AuthApiKey.cs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of idealingua-v1-runtime-rpc-c-sharp_2.13 Show documentation
Show all versions of idealingua-v1-runtime-rpc-c-sharp_2.13 Show documentation
idealingua-v1-runtime-rpc-c-sharp
The newest version!
using System;
namespace IRT.Transport.Authorization {
class AuthApiKey: AuthMethod {
public string ApiKey;
public AuthApiKey(string apiKey = null) {
ApiKey = apiKey;
}
public override bool FromValue(string value) {
var lower = value.ToLower();
if (value.StartsWith("api-key ", StringComparison.Ordinal)) {
ApiKey = value.Substring(8);
return true;
}
if (value.StartsWith("apikey ", StringComparison.Ordinal)) {
ApiKey = value.Substring(7);
return true;
}
return false;
}
public override string ToValue() {
return "Api-Key " + ApiKey;
}
}
}