ServiceAuthorizationManager 実装に (unity を使用して) リポジトリを挿入したいと思います。出来ますか?
public class APIKeyAuthorization : ServiceAuthorizationManager
{
private readonly IKeysService _keysService;
public APIKeyAuthorization(KeysService keysService)
{
_keysService = keysService;
}
protected override bool CheckAccessCore(OperationContext operationContext)
{
//var _keysService = new KeysService();
string key = GetAPIKey(operationContext);
string endpoint = GetEndpoint(operationContext); //ip address
if (_keysService.IsValidKey(key, endpoint))
{
return true;
}
else
{
// Send back an HTML reply
CreateErrorReply(operationContext, key);
return false;
}
}