自定义用户票据
This commit is contained in:
parent
e06576fa46
commit
d4345e311c
|
@ -28,7 +28,7 @@ namespace Falcon.SugarApi.ClaimTicket
|
||||||
}
|
}
|
||||||
|
|
||||||
Task IModelBinder.BindModelAsync(ModelBindingContext bindingContext) {
|
Task IModelBinder.BindModelAsync(ModelBindingContext bindingContext) {
|
||||||
if(bindingContext.ModelType != typeof(UserTicket)) {
|
if(!bindingContext.ModelType.IsAssignableTo(typeof(UserTicket))) {
|
||||||
return FailBind(bindingContext);
|
return FailBind(bindingContext);
|
||||||
}
|
}
|
||||||
var token = bindingContext.ValueProvider.GetValue(this.Options.HttpHeaderKey).ToString();
|
var token = bindingContext.ValueProvider.GetValue(this.Options.HttpHeaderKey).ToString();
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Falcon.SugarApi.ClaimTicket
|
||||||
throw new ArgumentNullException(nameof(context));
|
throw new ArgumentNullException(nameof(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(context.Metadata.ModelType == typeof(UserTicket)) {
|
if(context.Metadata.ModelType.IsAssignableTo(typeof(UserTicket))) {
|
||||||
return new BinderTypeModelBinder(typeof(ClaimTicketModelBinding));
|
return new BinderTypeModelBinder(typeof(ClaimTicketModelBinding));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user