Skip to content

Commit

Permalink
SignalR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesRandall committed Feb 16, 2020
1 parent 6745bca commit 7a03524
Show file tree
Hide file tree
Showing 4 changed files with 332 additions and 128 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<CommonPackageVersion>4.0.51-beta.4</CommonPackageVersion>
<CommonPackageVersion>4.0.52-beta.4</CommonPackageVersion>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace {{Namespace}}
)
{
log.LogInformation("HTTP trigger function {{Name}} processed a request.");
FunctionMonkey.PluginFunctions pluginFunctions = FunctionMonkey.Runtime.PluginFunctions["{{Name}}"];

FunctionMonkey.Runtime.FunctionProvidedLogger.Value = log;

Expand Down Expand Up @@ -68,20 +69,17 @@ namespace {{Namespace}}
{
return new UnauthorizedResult();
}
var tokenValidator = (FunctionMonkey.Abstractions.ITokenValidator)
FunctionMonkey.Runtime.ServiceProvider.GetService(typeof({{TokenValidatorTypeName}}));
principal = await tokenValidator.ValidateAsync(authorizationHeader);

principal = await pluginFunctions.ValidateToken(authorizationHeader);
if (principal == null)
{
return new UnauthorizedResult();
}
contextSetter.SetHttpContext(principal, requestUrl, headerDictionary);
contextSetter.SetHttpContext(principal, requestUrl, headerDictionary);
{{/if}}

{{#if AuthorizesClaims}}
var claimsPrincipalAuthorization = ({{ClaimsPrincipalAuthorizationTypeName}})
FunctionMonkey.Runtime.ServiceProvider.GetService(typeof({{ClaimsPrincipalAuthorizationTypeName}}));
var claimsPrincipalAuthorizationResult = await claimsPrincipalAuthorization.IsAuthorized(principal, req.Method, requestUrl);
var claimsPrincipalAuthorizationResult = await pluginFunctions.IsAuthorized(principal, req.Method, requestUrl);
if (!claimsPrincipalAuthorizationResult)
{
return new UnauthorizedResult();
Expand Down
Loading

0 comments on commit 7a03524

Please sign in to comment.