22 lines
646 B
C#
22 lines
646 B
C#
using xCommons.Extensions;
|
|
using xIdentityModels.Constants;
|
|
|
|
namespace xIdentityModels.Models {
|
|
public class XActionRequestToken {
|
|
public XAction Action { get; set; }
|
|
public XActionRequestContext Context { get; set; }
|
|
public string Token { get; set; }
|
|
|
|
public void Prepare (string secret) {
|
|
Token = (Action.ToString () +
|
|
secret +
|
|
Context.ToJSON ()).ToMd5String ();
|
|
}
|
|
|
|
public bool Validate (string secret) {
|
|
return (Action.ToString () +
|
|
secret +
|
|
Context.ToJSON ()).ToMd5String () == Token;
|
|
}
|
|
}
|
|
} |