Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 122 additions & 0 deletions fusionauth-netcore-client/src/io/fusionauth/FusionAuthClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,15 @@ public Task<ClientResponse<DeviceApprovalResponse>> ApproveDeviceAsync(string cl
.goAsync<DeviceApprovalResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<DeviceApprovalResponse>> ApproveDeviceWithRequestAsync(DeviceApprovalRequest request) {
return buildClient()
.withUri("/oauth2/device/approve")
.withJSONBody(request)
.withMethod("Post")
.goAsync<DeviceApprovalResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<ActionResponse>> CancelActionAsync(Guid? actionId, ActionRequest request) {
return buildClient()
Expand Down Expand Up @@ -225,6 +234,15 @@ public Task<ClientResponse<AccessToken>> ClientCredentialsGrantAsync(string clie
.goAsync<AccessToken>();
}

/// <inheritdoc/>
public Task<ClientResponse<AccessToken>> ClientCredentialsGrantWithRequestAsync(ClientCredentialsGrantRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/token")
.withJSONBody(request)
.withMethod("Post")
.goAsync<AccessToken>();
}

/// <inheritdoc/>
public Task<ClientResponse<UserCommentResponse>> CommentOnUserAsync(UserCommentRequest request) {
return buildClient()
Expand Down Expand Up @@ -966,6 +984,29 @@ public Task<ClientResponse<RESTVoid>> DeleteWebhookAsync(Guid? webhookId) {
.goAsync<RESTVoid>();
}

/// <inheritdoc/>
public Task<ClientResponse<DeviceResponse>> DeviceAuthorizeAsync(string client_id, string client_secret, string scope) {
var body = new Dictionary<string, string> {
{ "client_id", client_id },
{ "client_secret", client_secret },
{ "scope", scope },
};
return buildAnonymousClient()
.withUri("/oauth2/device_authorize")
.withFormData(new FormUrlEncodedContent(body))
.withMethod("Post")
.goAsync<DeviceResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<DeviceResponse>> DeviceAuthorizeWithRequestAsync(DeviceAuthorizationRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/device_authorize")
.withJSONBody(request)
.withMethod("Post")
.goAsync<DeviceResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<RESTVoid>> DisableTwoFactorAsync(Guid? userId, string methodId, string code) {
return buildClient()
Expand Down Expand Up @@ -1030,6 +1071,24 @@ public Task<ClientResponse<AccessToken>> ExchangeOAuthCodeForAccessTokenUsingPKC
.goAsync<AccessToken>();
}

/// <inheritdoc/>
public Task<ClientResponse<AccessToken>> ExchangeOAuthCodeForAccessTokenUsingPKCEWithRequestAsync(OAuthCodePKCEAccessTokenRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/token")
.withJSONBody(request)
.withMethod("Post")
.goAsync<AccessToken>();
}

/// <inheritdoc/>
public Task<ClientResponse<AccessToken>> ExchangeOAuthCodeForAccessTokenWithRequestAsync(OAuthCodeAccessTokenRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/token")
.withJSONBody(request)
.withMethod("Post")
.goAsync<AccessToken>();
}

/// <inheritdoc/>
public Task<ClientResponse<AccessToken>> ExchangeRefreshTokenForAccessTokenAsync(string refresh_token, string client_id, string client_secret, string scope, string user_code) {
var body = new Dictionary<string, string> {
Expand All @@ -1047,6 +1106,15 @@ public Task<ClientResponse<AccessToken>> ExchangeRefreshTokenForAccessTokenAsync
.goAsync<AccessToken>();
}

/// <inheritdoc/>
public Task<ClientResponse<AccessToken>> ExchangeRefreshTokenForAccessTokenWithRequestAsync(RefreshTokenAccessTokenRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/token")
.withJSONBody(request)
.withMethod("Post")
.goAsync<AccessToken>();
}

/// <inheritdoc/>
public Task<ClientResponse<JWTRefreshResponse>> ExchangeRefreshTokenForJWTAsync(RefreshRequest request) {
return buildAnonymousClient()
Expand Down Expand Up @@ -1074,6 +1142,15 @@ public Task<ClientResponse<AccessToken>> ExchangeUserCredentialsForAccessTokenAs
.goAsync<AccessToken>();
}

/// <inheritdoc/>
public Task<ClientResponse<AccessToken>> ExchangeUserCredentialsForAccessTokenWithRequestAsync(UserCredentialsAccessTokenRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/token")
.withJSONBody(request)
.withMethod("Post")
.goAsync<AccessToken>();
}

/// <inheritdoc/>
public Task<ClientResponse<ForgotPasswordResponse>> ForgotPasswordAsync(ForgotPasswordRequest request) {
return buildClient()
Expand Down Expand Up @@ -1199,6 +1276,15 @@ public Task<ClientResponse<IntrospectResponse>> IntrospectAccessTokenAsync(strin
.goAsync<IntrospectResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<IntrospectResponse>> IntrospectAccessTokenWithRequestAsync(AccessTokenIntrospectRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/introspect")
.withJSONBody(request)
.withMethod("Post")
.goAsync<IntrospectResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<IntrospectResponse>> IntrospectClientCredentialsAccessTokenAsync(string token) {
var body = new Dictionary<string, string> {
Expand All @@ -1211,6 +1297,15 @@ public Task<ClientResponse<IntrospectResponse>> IntrospectClientCredentialsAcces
.goAsync<IntrospectResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<IntrospectResponse>> IntrospectClientCredentialsAccessTokenWithRequestAsync(ClientCredentialsAccessTokenIntrospectRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/introspect")
.withJSONBody(request)
.withMethod("Post")
.goAsync<IntrospectResponse>();
}

/// <inheritdoc/>
public Task<ClientResponse<IssueResponse>> IssueJWTAsync(Guid? applicationId, string encodedJWT, string refreshToken) {
return buildAnonymousClient()
Expand Down Expand Up @@ -2532,6 +2627,24 @@ public Task<ClientResponse<RESTVoid>> RetrieveUserCodeUsingAPIKeyAsync(string us
.goAsync<RESTVoid>();
}

/// <inheritdoc/>
public Task<ClientResponse<RESTVoid>> RetrieveUserCodeUsingAPIKeyWithRequestAsync(RetrieveUserCodeUsingAPIKeyRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/device/user-code")
.withJSONBody(request)
.withMethod("Post")
.goAsync<RESTVoid>();
}

/// <inheritdoc/>
public Task<ClientResponse<RESTVoid>> RetrieveUserCodeWithRequestAsync(RetrieveUserCodeRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/device/user-code")
.withJSONBody(request)
.withMethod("Post")
.goAsync<RESTVoid>();
}

/// <inheritdoc/>
public Task<ClientResponse<UserCommentResponse>> RetrieveUserCommentsAsync(Guid? userId) {
return buildClient()
Expand Down Expand Up @@ -3482,6 +3595,15 @@ public Task<ClientResponse<RESTVoid>> ValidateDeviceAsync(string user_code, stri
.goAsync<RESTVoid>();
}

/// <inheritdoc/>
public Task<ClientResponse<RESTVoid>> ValidateDeviceWithRequestAsync(ValidateDeviceRequest request) {
return buildAnonymousClient()
.withUri("/oauth2/device/validate")
.withJSONBody(request)
.withMethod("Post")
.goAsync<RESTVoid>();
}

/// <inheritdoc/>
public Task<ClientResponse<ValidateResponse>> ValidateJWTAsync(string encodedJWT) {
return buildAnonymousClient()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public ClientResponse<DeviceApprovalResponse> ApproveDevice(string client_id, st
return client.ApproveDeviceAsync(client_id, client_secret, token, user_code).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<DeviceApprovalResponse> ApproveDeviceWithRequest(DeviceApprovalRequest request) {
return client.ApproveDeviceWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<ActionResponse> CancelAction(Guid? actionId, ActionRequest request) {
return client.CancelActionAsync(actionId, request).GetAwaiter().GetResult();
Expand Down Expand Up @@ -122,6 +127,11 @@ public ClientResponse<AccessToken> ClientCredentialsGrant(string client_id, stri
return client.ClientCredentialsGrantAsync(client_id, client_secret, scope).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<AccessToken> ClientCredentialsGrantWithRequest(ClientCredentialsGrantRequest request) {
return client.ClientCredentialsGrantWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<UserCommentResponse> CommentOnUser(UserCommentRequest request) {
return client.CommentOnUserAsync(request).GetAwaiter().GetResult();
Expand Down Expand Up @@ -504,6 +514,16 @@ public ClientResponse<RESTVoid> DeleteWebhook(Guid? webhookId) {
return client.DeleteWebhookAsync(webhookId).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<DeviceResponse> DeviceAuthorize(string client_id, string client_secret, string scope) {
return client.DeviceAuthorizeAsync(client_id, client_secret, scope).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<DeviceResponse> DeviceAuthorizeWithRequest(DeviceAuthorizationRequest request) {
return client.DeviceAuthorizeWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<RESTVoid> DisableTwoFactor(Guid? userId, string methodId, string code) {
return client.DisableTwoFactorAsync(userId, methodId, code).GetAwaiter().GetResult();
Expand All @@ -529,11 +549,26 @@ public ClientResponse<AccessToken> ExchangeOAuthCodeForAccessTokenUsingPKCE(stri
return client.ExchangeOAuthCodeForAccessTokenUsingPKCEAsync(code, client_id, client_secret, redirect_uri, code_verifier).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<AccessToken> ExchangeOAuthCodeForAccessTokenUsingPKCEWithRequest(OAuthCodePKCEAccessTokenRequest request) {
return client.ExchangeOAuthCodeForAccessTokenUsingPKCEWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<AccessToken> ExchangeOAuthCodeForAccessTokenWithRequest(OAuthCodeAccessTokenRequest request) {
return client.ExchangeOAuthCodeForAccessTokenWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<AccessToken> ExchangeRefreshTokenForAccessToken(string refresh_token, string client_id, string client_secret, string scope, string user_code) {
return client.ExchangeRefreshTokenForAccessTokenAsync(refresh_token, client_id, client_secret, scope, user_code).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<AccessToken> ExchangeRefreshTokenForAccessTokenWithRequest(RefreshTokenAccessTokenRequest request) {
return client.ExchangeRefreshTokenForAccessTokenWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<JWTRefreshResponse> ExchangeRefreshTokenForJWT(RefreshRequest request) {
return client.ExchangeRefreshTokenForJWTAsync(request).GetAwaiter().GetResult();
Expand All @@ -544,6 +579,11 @@ public ClientResponse<AccessToken> ExchangeUserCredentialsForAccessToken(string
return client.ExchangeUserCredentialsForAccessTokenAsync(username, password, client_id, client_secret, scope, user_code).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<AccessToken> ExchangeUserCredentialsForAccessTokenWithRequest(UserCredentialsAccessTokenRequest request) {
return client.ExchangeUserCredentialsForAccessTokenWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<ForgotPasswordResponse> ForgotPassword(ForgotPasswordRequest request) {
return client.ForgotPasswordAsync(request).GetAwaiter().GetResult();
Expand Down Expand Up @@ -609,11 +649,21 @@ public ClientResponse<IntrospectResponse> IntrospectAccessToken(string client_id
return client.IntrospectAccessTokenAsync(client_id, token).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<IntrospectResponse> IntrospectAccessTokenWithRequest(AccessTokenIntrospectRequest request) {
return client.IntrospectAccessTokenWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<IntrospectResponse> IntrospectClientCredentialsAccessToken(string token) {
return client.IntrospectClientCredentialsAccessTokenAsync(token).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<IntrospectResponse> IntrospectClientCredentialsAccessTokenWithRequest(ClientCredentialsAccessTokenIntrospectRequest request) {
return client.IntrospectClientCredentialsAccessTokenWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<IssueResponse> IssueJWT(Guid? applicationId, string encodedJWT, string refreshToken) {
return client.IssueJWTAsync(applicationId, encodedJWT, refreshToken).GetAwaiter().GetResult();
Expand Down Expand Up @@ -1324,6 +1374,16 @@ public ClientResponse<RESTVoid> RetrieveUserCodeUsingAPIKey(string user_code) {
return client.RetrieveUserCodeUsingAPIKeyAsync(user_code).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<RESTVoid> RetrieveUserCodeUsingAPIKeyWithRequest(RetrieveUserCodeUsingAPIKeyRequest request) {
return client.RetrieveUserCodeUsingAPIKeyWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<RESTVoid> RetrieveUserCodeWithRequest(RetrieveUserCodeRequest request) {
return client.RetrieveUserCodeWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<UserCommentResponse> RetrieveUserComments(Guid? userId) {
return client.RetrieveUserCommentsAsync(userId).GetAwaiter().GetResult();
Expand Down Expand Up @@ -1823,6 +1883,11 @@ public ClientResponse<RESTVoid> ValidateDevice(string user_code, string client_i
return client.ValidateDeviceAsync(user_code, client_id).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<RESTVoid> ValidateDeviceWithRequest(ValidateDeviceRequest request) {
return client.ValidateDeviceWithRequestAsync(request).GetAwaiter().GetResult();
}

/// <inheritdoc/>
public ClientResponse<ValidateResponse> ValidateJWT(string encodedJWT) {
return client.ValidateJWTAsync(encodedJWT).GetAwaiter().GetResult();
Expand Down
Loading