feat(ConfiguredConsumerService): ReadLocalAsync Methode hinzugefügt, um den Verbraucher von Auth.API zu erhalten
This commit is contained in:
@@ -68,6 +68,6 @@
|
|||||||
public bool IsEssential { get => _optionsBase.IsEssential; set => _optionsBase.IsEssential = value; }
|
public bool IsEssential { get => _optionsBase.IsEssential; set => _optionsBase.IsEssential = value; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public CookieOptions Create(TimeSpan? lifetime = null) => new(_optionsBase) { Expires = DateTime.UtcNow.AddTicks(lifetime?.Ticks ?? Lifetime.Ticks) };
|
public CookieOptions Create() => new(_optionsBase) { Expires = DateTime.UtcNow.AddTicks(Lifetime.Ticks) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,8 @@ namespace DigitalData.Auth.API.Services
|
|||||||
|
|
||||||
public Task<Consumer?> ReadByNameAsync(string name) => Task.Run(() => _consumers.FirstOrDefault(api => api.Name == name));
|
public Task<Consumer?> ReadByNameAsync(string name) => Task.Run(() => _consumers.FirstOrDefault(api => api.Name == name));
|
||||||
|
|
||||||
|
public Task<Consumer> ReadLocalAsync() => Task.Run(() => _consumers.FirstOrDefault() ?? throw new InvalidOperationException("Unable to read the local consumer because no consumers are available."));
|
||||||
|
|
||||||
public async Task<bool> VerifyAsync(string name, string password) => (await ReadByNameAsync(name))?.Password == password;
|
public async Task<bool> VerifyAsync(string name, string password) => (await ReadByNameAsync(name))?.Password == password;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,8 @@ namespace DigitalData.Auth.API.Services.Contracts
|
|||||||
|
|
||||||
public Task<Consumer?> ReadByNameAsync(string name);
|
public Task<Consumer?> ReadByNameAsync(string name);
|
||||||
|
|
||||||
|
public Task<Consumer> ReadLocalAsync();
|
||||||
|
|
||||||
public Task<bool> VerifyAsync(string name, string password);
|
public Task<bool> VerifyAsync(string name, string password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user