Skip to content

Commit

Permalink
Merge pull request #44 from manuscrypt/main
Browse files Browse the repository at this point in the history
provide SmtpServer payload, fix content-type of VerifyUserEmailAddress…
  • Loading branch information
lvermeulen authored May 7, 2021
2 parents 5870da2 + d3a54e6 commit e72b3ad
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
26 changes: 25 additions & 1 deletion src/Keycloak.Net/Models/RealmsAdmin/SmtpServer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
namespace Keycloak.Net.Models.RealmsAdmin
using Newtonsoft.Json;

namespace Keycloak.Net.Models.RealmsAdmin
{
public class SmtpServer
{
[JsonProperty("host")]
public string Host { get; set; }
[JsonProperty("ssl")]
public string Ssl { get; set; }
[JsonProperty("starttls")]
public string StartTls { get; set; }
[JsonProperty("user")]
public string User { get; set; }
[JsonProperty("password")]
public string Password { get; set; }
[JsonProperty("auth")]
public string Auth { get; set; }
[JsonProperty("from")]
public string From { get; set; }
[JsonProperty("fromDisplayName")]
public string FromDisplayName { get; set; }
[JsonProperty("replyTo")]
public string ReplyTo { get; set; }
[JsonProperty("replyToDisplayName")]
public string ReplyToDisplayName { get; set; }
[JsonProperty("envelopeFrom")]
public string EnvelopeFrom { get; set; }
}
}
15 changes: 10 additions & 5 deletions src/Keycloak.Net/Users/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,21 @@ public async Task<SetPasswordResponse> SetUserPasswordAsync(string realm, string

public async Task<bool> VerifyUserEmailAddressAsync(string realm, string userId, string clientId = null, string redirectUri = null)
{
var queryParams = new Dictionary<string, object>
var queryParams = new Dictionary<string, object>();
if (!string.IsNullOrEmpty(clientId))
{
["client_id"] = clientId,
["redirect_uri"] = redirectUri
};
queryParams.Add("client_id", clientId);
}

if (!string.IsNullOrEmpty(redirectUri))
{
queryParams.Add("redirect_uri", redirectUri);
}

var response = await GetBaseUrl(realm)
.AppendPathSegment($"/admin/realms/{realm}/users/{userId}/send-verify-email")
.SetQueryParams(queryParams)
.PutAsync(new StringContent(""))
.PutJsonAsync(null)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
}
Expand Down

0 comments on commit e72b3ad

Please sign in to comment.