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

User security log feature. #4492

Closed
maliming opened this issue Jun 25, 2020 · 3 comments
Closed

User security log feature. #4492

maliming opened this issue Jun 25, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@maliming
Copy link
Member

I plan to implement the IUserSecurityLog feature in Volo.Abp.Security. Similar to the audit log.

It has an interface (IUserSecurityLogStore) + default implementation class + UserSecurityLogInfo model class.

User security logs can be written in any layer in any module, such as login success/failure, logout. Change password. Modify email, get refresh_token and any security logs that need to be recorded.

After that,Implemented EF/MongoDB storage in the Identity module.

public interface IUserSecurityLogStore
{
	Task SaveAsync(UserSecurityLogInfo userSecurityLogInfo);
}

[Serializable]
public class UserSecurityLogInfo : IHasExtraProperties
{
	/// <summary>
	/// The name of the application or service writing user security logs.
	/// Default: null.
	/// </summary>
	public string ApplicationName { get; set; }

	/// <summary>
	/// Web, JWT, Identity, Identity_Server
	/// </summary>
	public string Identity { get; set; }

	/// <summary>
	/// login_successful, login_failed, logout, change_pwd, refresh_token...
	/// </summary>
	public string Action { get; set; }

	public Dictionary<string, object> ExtraProperties { get; }

	public Guid? UserId { get; set; }

	public string UserName { get; set; }

	public Guid? TenantId { get; set; }

	public string TenantName { get; set; }

	public string ClientId { get; set; }

	public string ClientName { get; set; }

	public string CorrelationId { get; set; }

	public string ClientIpAddress { get; set; }

	public string BrowserInfo { get; set; }

	public DateTime CreationTime { get; set; }

	public UserSecurityLogInfo()
	{
		ExtraProperties = new Dictionary<string, object>();
	}
}
@maliming maliming added this to the 3.1 milestone Jun 25, 2020
@maliming maliming self-assigned this Jun 25, 2020
@olicooper
Copy link
Contributor

So would this be similar to AbpUserLoginAttempts the in the old framework except it is more generic? And would it log user login/registration attempts as default? #2813

@maliming
Copy link
Member Author

maliming commented Jul 2, 2020

Yes.

@maliming
Copy link
Member Author

#4675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants