Skip to content
This repository was archived by the owner on Feb 23, 2025. It is now read-only.

Make non virtual properties virtual to enable mocking #69

Merged
merged 3 commits into from Jun 24, 2018
Merged
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
16 changes: 8 additions & 8 deletions src/IdentityModel.OidcClient/OidcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public OidcClient(OidcClientOptions options)
/// <param name="extraParameters">The extra parameters.</param>
/// <returns></returns>
[Obsolete("This method will be removed in a future version. Please change your code to use LoginRequest")]
public async Task<LoginResult> LoginAsync(DisplayMode displayMode = DisplayMode.Visible, int timeout = 300, object extraParameters = null)
public virtual async Task<LoginResult> LoginAsync(DisplayMode displayMode = DisplayMode.Visible, int timeout = 300, object extraParameters = null)
{
return await LoginAsync(new LoginRequest
{
Expand All @@ -82,7 +82,7 @@ public async Task<LoginResult> LoginAsync(DisplayMode displayMode = DisplayMode.
/// </summary>
/// <param name="request">The login request.</param>
/// <returns></returns>
public async Task<LoginResult> LoginAsync(LoginRequest request)
public virtual async Task<LoginResult> LoginAsync(LoginRequest request)
{
_logger.LogTrace("LoginAsync");
_logger.LogInformation("Starting authentication request.");
Expand Down Expand Up @@ -113,7 +113,7 @@ public async Task<LoginResult> LoginAsync(LoginRequest request)
/// </summary>
/// <param name="request">The logout request.</param>
/// <returns></returns>
public async Task<string> PrepareLogoutAsync(LogoutRequest request = null)
public virtual async Task<string> PrepareLogoutAsync(LogoutRequest request = null)
{
if (request == null) request = new LogoutRequest();
await EnsureConfigurationAsync();
Expand All @@ -132,7 +132,7 @@ public async Task<string> PrepareLogoutAsync(LogoutRequest request = null)
/// </summary>
/// <param name="request">The logout request.</param>
/// <returns></returns>
public async Task LogoutAsync(LogoutRequest request = null)
public virtual async Task LogoutAsync(LogoutRequest request = null)
{
if (request == null) request = new LogoutRequest();
await EnsureConfigurationAsync();
Expand All @@ -145,7 +145,7 @@ public async Task LogoutAsync(LogoutRequest request = null)
/// </summary>
/// <param name="extraParameters">extra parameters to send to the authorize endpoint.</param>
/// <returns>State for initiating the authorize request and processing the response</returns>
public async Task<AuthorizeState> PrepareLoginAsync(object extraParameters = null)
public virtual async Task<AuthorizeState> PrepareLoginAsync(object extraParameters = null)
{
_logger.LogTrace("PrepareLoginAsync");

Expand All @@ -162,7 +162,7 @@ public async Task<AuthorizeState> PrepareLoginAsync(object extraParameters = nul
/// <returns>
/// Result of the login response validation
/// </returns>
public async Task<LoginResult> ProcessResponseAsync(string data, AuthorizeState state, object extraParameters = null)
public virtual async Task<LoginResult> ProcessResponseAsync(string data, AuthorizeState state, object extraParameters = null)
{
_logger.LogTrace("ProcessResponseAsync");
_logger.LogInformation("Processing response.");
Expand Down Expand Up @@ -246,7 +246,7 @@ public async Task<LoginResult> ProcessResponseAsync(string data, AuthorizeState
/// </summary>
/// <param name="accessToken">The access token.</param>
/// <returns>User claims</returns>
public async Task<UserInfoResult> GetUserInfoAsync(string accessToken)
public virtual async Task<UserInfoResult> GetUserInfoAsync(string accessToken)
{
_logger.LogTrace("GetUserInfoAsync");

Expand Down Expand Up @@ -282,7 +282,7 @@ public async Task<UserInfoResult> GetUserInfoAsync(string accessToken)
/// <returns>
/// A token response.
/// </returns>
public async Task<RefreshTokenResult> RefreshTokenAsync(string refreshToken, object extraParameters = null)
public virtual async Task<RefreshTokenResult> RefreshTokenAsync(string refreshToken, object extraParameters = null)
{
_logger.LogTrace("RefreshTokenAsync");

Expand Down
14 changes: 7 additions & 7 deletions src/IdentityModel.OidcClient/Results/LoginResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,54 +36,54 @@ public LoginResult(string error)
/// <value>
/// The user.
/// </value>
public ClaimsPrincipal User { get; internal set; }
public virtual ClaimsPrincipal User { get; internal set; }

/// <summary>
/// Gets or sets the access token.
/// </summary>
/// <value>
/// The access token.
/// </value>
public string AccessToken { get; internal set; }
public virtual string AccessToken { get; internal set; }

/// <summary>
/// Gets or sets the identity token.
/// </summary>
/// <value>
/// The identity token.
/// </value>
public string IdentityToken { get; internal set; }
public virtual string IdentityToken { get; internal set; }

/// <summary>
/// Gets or sets the refresh token.
/// </summary>
/// <value>
/// The refresh token.
/// </value>
public string RefreshToken { get; internal set; }
public virtual string RefreshToken { get; internal set; }

/// <summary>
/// Gets or sets the access token expiration.
/// </summary>
/// <value>
/// The access token expiration.
/// </value>
public DateTime AccessTokenExpiration { get; internal set; }
public virtual DateTime AccessTokenExpiration { get; internal set; }

/// <summary>
/// Gets or sets the authentication time.
/// </summary>
/// <value>
/// The authentication time.
/// </value>
public DateTime AuthenticationTime { get; internal set; }
public virtual DateTime AuthenticationTime { get; internal set; }

/// <summary>
/// Gets or sets the refresh token handler.
/// </summary>
/// <value>
/// The refresh token handler.
/// </value>
public HttpMessageHandler RefreshTokenHandler { get; internal set; }
public virtual HttpMessageHandler RefreshTokenHandler { get; internal set; }
}
}
8 changes: 4 additions & 4 deletions src/IdentityModel.OidcClient/Results/RefreshTokenResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ public class RefreshTokenResult : Result
/// <value>
/// The identity token.
/// </value>
public string IdentityToken { get; internal set; }
public virtual string IdentityToken { get; internal set; }

/// <summary>
/// Gets or sets the access token.
/// </summary>
/// <value>
/// The access token.
/// </value>
public string AccessToken { get; internal set; }
public virtual string AccessToken { get; internal set; }

/// <summary>
/// Gets or sets the refresh token.
/// </summary>
/// <value>
/// The refresh token.
/// </value>
public string RefreshToken { get; internal set; }
public virtual string RefreshToken { get; internal set; }

/// <summary>
/// Gets or sets the expires in.
/// </summary>
/// <value>
/// The expires in.
/// </value>
public int ExpiresIn { get; internal set; }
public virtual int ExpiresIn { get; internal set; }
}
}
2 changes: 1 addition & 1 deletion src/IdentityModel.OidcClient/Results/UserInfoResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public class UserInfoResult : Result
/// <value>
/// The claims.
/// </value>
public IEnumerable<Claim> Claims { get; internal set; }
public virtual IEnumerable<Claim> Claims { get; internal set; }
}
}