Skip to content

Instantly share code, notes, and snippets.

@CoderBK
Created January 13, 2022 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CoderBK/3f34d2a770ef7149c66ee8ff0fbf50da to your computer and use it in GitHub Desktop.
Save CoderBK/3f34d2a770ef7149c66ee8ff0fbf50da to your computer and use it in GitHub Desktop.
namespace AzureFunctionAuthorization.Binding {
public class JWTAuthorizationBinding : IBinding {
private readonly IJWTHandlerService _jWTHandlerService;
public JWTAuthorizationBinding(IJWTHandlerService jWTHandlerService) {
_jWTHandlerService = jWTHandlerService;
}
public bool FromAttribute => true;
public Task<IValueProvider> BindAsync(BindingContext context) {
var data = context.BindingData["req"] as HttpRequest;
return Task.FromResult<IValueProvider>(new JWTTokenProvider(data,_jWTHandlerService));
}
public Task<IValueProvider> BindAsync(object value, ValueBindingContext context) {
return null;
}
public ParameterDescriptor ToParameterDescriptor() {
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment