Files
semantic-kernel/samples/dotnet/KernelHttpServer/TokenAuthenticationProvider.cs
T
Roger Barreto 51ed177848 Correct namespaces in KernelHttpServer, Fixed code style warnings (#36)
### Motivation and Context

The Semantic Kernel naming convention of Skills and Functions can cause
confusion with the naming of the Azure Function sample project.

### Description
1. Updated sample `KernelHttpServer` project namespaces to match the
project name.
1. Small adjustments to code style warnings (naming, unused namespaces,
spacing).
2023-03-08 15:33:22 -08:00

26 lines
645 B
C#

// Copyright (c) Microsoft. All rights reserved.
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.Graph;
namespace KernelHttpServer;
internal sealed class TokenAuthenticationProvider : IAuthenticationProvider
{
private readonly string _token;
public TokenAuthenticationProvider(string token)
{
this._token = token;
}
public Task AuthenticateRequestAsync(HttpRequestMessage request)
{
return Task.FromResult(request.Headers.Authorization = new AuthenticationHeaderValue(
scheme: "bearer",
parameter: this._token));
}
}