forked from lvermeulen/Keycloak.Net
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from CesarD/feat/upgrade_flurlhttp
Upgrade Flurl.Http to v4 and Json serialization refactor
- Loading branch information
Showing
244 changed files
with
8,278 additions
and
6,611 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"projects": [ "src", "test" ], | ||
"sdk": { | ||
"version": "6.0.200", | ||
"version": "8.0.401", | ||
"rollForward": "latestFeature" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
using Flurl.Http; | ||
using Keycloak.Net.Models.AttackDetection; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Keycloak.Net.Models.AttackDetection; | ||
|
||
namespace Keycloak.Net | ||
namespace Keycloak.Net; | ||
|
||
public partial class KeycloakClient | ||
{ | ||
public partial class KeycloakClient | ||
{ | ||
public async Task<bool> ClearUserLoginFailuresAsync(string realm, CancellationToken cancellationToken = default) | ||
{ | ||
var response = await GetBaseUrl(realm) | ||
.AppendPathSegment($"/admin/realms/{realm}/attack-detection/brute-force/users") | ||
.DeleteAsync(cancellationToken) | ||
.ConfigureAwait(false); | ||
return response.ResponseMessage.IsSuccessStatusCode; | ||
} | ||
public async Task<bool> ClearUserLoginFailuresAsync(string realm, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
var response = await GetBaseUrl(realm).AppendPathSegment($"/admin/realms/{realm}/attack-detection/brute-force/users") | ||
.DeleteAsync(cancellationToken: cancellationToken) | ||
.ConfigureAwait(false); | ||
return response.ResponseMessage.IsSuccessStatusCode; | ||
} | ||
|
||
public async Task<bool> ClearUserLoginFailuresAsync(string realm, string userId, CancellationToken cancellationToken = default) | ||
{ | ||
var response = await GetBaseUrl(realm) | ||
.AppendPathSegment($"/admin/realms/{realm}/attack-detection/brute-force/users/{userId}") | ||
.DeleteAsync(cancellationToken) | ||
.ConfigureAwait(false); | ||
return response.ResponseMessage.IsSuccessStatusCode; | ||
} | ||
public async Task<bool> ClearUserLoginFailuresAsync(string realm, | ||
string userId, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
var response = await GetBaseUrl(realm).AppendPathSegment($"/admin/realms/{realm}/attack-detection/brute-force/users/{userId}") | ||
.DeleteAsync(cancellationToken: cancellationToken) | ||
.ConfigureAwait(false); | ||
return response.ResponseMessage.IsSuccessStatusCode; | ||
} | ||
|
||
public async Task<UserNameStatus> GetUserNameStatusInBruteForceDetectionAsync(string realm, string userId, CancellationToken cancellationToken = default) => await GetBaseUrl(realm) | ||
.AppendPathSegment($"/admin/realms/{realm}/attack-detection/brute-force/users/{userId}") | ||
.GetJsonAsync<UserNameStatus>(cancellationToken) | ||
.ConfigureAwait(false); | ||
} | ||
} | ||
public async Task<UserNameStatus> GetUserNameStatusInBruteForceDetectionAsync(string realm, | ||
string userId, | ||
CancellationToken cancellationToken = default) => | ||
await GetBaseUrl(realm).AppendPathSegment($"/admin/realms/{realm}/attack-detection/brute-force/users/{userId}") | ||
.GetJsonAsync<UserNameStatus>(cancellationToken: cancellationToken) | ||
.ConfigureAwait(false); | ||
} |
Oops, something went wrong.