Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additions to Invalidate Token API #3937

Merged
merged 5 commits into from
Jul 15, 2019
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,83 @@

namespace Nest
{
/// <summary>
/// Invalidates one or more access tokens or refresh tokens.
/// </summary>
[MapsApi("security.invalidate_token.json")]
public partial interface IInvalidateUserAccessTokenRequest
{
/// <summary>
/// An access token.
/// This parameter cannot be used any of <see cref="RefreshToken"/>, <see cref="RealmName"/> or <see cref="Username"/> are used.
codebrain marked this conversation as resolved.
Show resolved Hide resolved
/// </summary>
[DataMember(Name ="token")]
string Token { get; set; }

/// <summary>
/// A refresh token.
/// This parameter cannot be used any of <see cref="RefreshToken"/>, <see cref="RealmName"/> or <see cref="Username"/> are used.
/// </summary>
[DataMember(Name = "refresh_token")]
string RefreshToken { get; set; }

/// <summary>
/// The name of an authentication realm.
/// This parameter cannot be used with either <see cref="RefreshToken"/> or <see cref="Token"/>.
/// </summary>
[DataMember(Name = "realm_name")]
string RealmName { get; set; }

/// <summary>
/// The username of a user.
/// This parameter cannot be used with either <see cref="RefreshToken"/> or <see cref="Token"/>.
/// </summary>
[DataMember(Name = "username")]
string Username { get; set; }
}


public partial class InvalidateUserAccessTokenRequest
{
public InvalidateUserAccessTokenRequest(string token) => ((IInvalidateUserAccessTokenRequest)this).Token = token;

[DataMember(Name ="token")]
/// <inheritdoc />
string IInvalidateUserAccessTokenRequest.Token { get; set; }

/// <inheritdoc />
string IInvalidateUserAccessTokenRequest.RefreshToken { get; set; }

/// <inheritdoc />
string IInvalidateUserAccessTokenRequest.RealmName { get; set; }

/// <inheritdoc />
string IInvalidateUserAccessTokenRequest.Username { get; set; }
}

public partial class InvalidateUserAccessTokenDescriptor
{
/// <inheritdoc cref="IInvalidateUserAccessTokenRequest.Token" />
public InvalidateUserAccessTokenDescriptor(string token) => ((IInvalidateUserAccessTokenRequest)this).Token = token;

/// <inheritdoc cref="IInvalidateUserAccessTokenRequest.RefreshToken" />
public InvalidateUserAccessTokenDescriptor RefreshToken(string refreshToken) => Assign(refreshToken, (a, v) => a.RefreshToken = v);

/// <inheritdoc cref="IInvalidateUserAccessTokenRequest.RealmName" />
public InvalidateUserAccessTokenDescriptor RealmName(string realmName) => Assign(realmName, (a, v) => a.RealmName = v);

/// <inheritdoc cref="IInvalidateUserAccessTokenRequest.Username" />
public InvalidateUserAccessTokenDescriptor Username(string username) => Assign(username, (a, v) => a.Username = v);

/// <inheritdoc />
codebrain marked this conversation as resolved.
Show resolved Hide resolved
string IInvalidateUserAccessTokenRequest.Token { get; set; }

/// <inheritdoc />
string IInvalidateUserAccessTokenRequest.RefreshToken { get; set; }

/// <inheritdoc />
string IInvalidateUserAccessTokenRequest.RealmName { get; set; }

/// <inheritdoc />
string IInvalidateUserAccessTokenRequest.Username { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Elasticsearch.Net;

namespace Nest
{
public class InvalidateUserAccessTokenResponse : ResponseBase
{
/// <summary>
/// The number of the tokens that were invalidated as part of this request.
/// </summary>
[DataMember(Name = "invalidated_tokens")]
public long InvalidatedTokens { get; internal set; }

/// <summary>
/// The number of tokens that were already invalidated.
/// </summary>
[DataMember(Name = "previously_invalidated_tokens")]
public long PreviouslyInvalidatedTokens { get; internal set; }

/// <summary>
/// The number of errors that were encountered when invalidating the tokens.
/// </summary>
[DataMember(Name = "error_count")]
public long ErrorCount { get; internal set; }

/// <summary>
/// Details about these errors. This field is not present in the response when there are no errors.
/// </summary>
[DataMember(Name = "error_details")]
public IReadOnlyCollection<ErrorCause> ErrorDetails { get; internal set; } = EmptyReadOnly<ErrorCause>.Collection;
}
}