Created
June 12, 2019 11:27
-
-
Save tomasjurasek/ba7f22ae563ee76330e7529f902c9a78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomGrantType : ICustomGrantValidator | |
{ | |
public string GrantType => "wechat_credentials"; | |
public Task<CustomGrantValidationResult> ValidateAsync(ValidatedTokenRequest request) | |
{ | |
var wechatToken = request.Raw.Get("wechat_token"); | |
var wechatUnionId = request.Raw.Get("wechat_unionId"); | |
if (string.IsNullOrWhiteSpace(wechatToken)) | |
{ | |
return Task.FromResult<CustomGrantValidationResult>( | |
new CustomGrantValidationResult($"Missing parameter wechat_token")); | |
} | |
if (string.IsNullOrWhiteSpace(wechatUnionId)) | |
{ | |
return Task.FromResult<CustomGrantValidationResult>( | |
new CustomGrantValidationResult($"Missing parameter wechat_unionId")); | |
} | |
return Task.FromResult(new CustomGrantValidationResult()); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment