-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work-in-progress, adding background job, refactoring apps to Core and…
… using the ConfigurationBuilder APIs
- Loading branch information
Showing
15 changed files
with
142 additions
and
131 deletions.
There are no files selected for viewing
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
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
11 changes: 11 additions & 0 deletions
11
Joonasw.AzureAdApiSample.ConsoleBackgroundJob/JobSettings.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Joonasw.AzureAdApiSample.ConsoleBackgroundJob | ||
{ | ||
public class JobSettings | ||
{ | ||
public string Authority { get; set; } | ||
public string ClientId { get; set; } | ||
public string ClientSecret { get; set; } | ||
public string ApiResourceUri { get; set; } | ||
public string ApiBaseUrl { get; set; } | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...zureAdApiSample.ConsoleBackgroundJob/Joonasw.AzureAdApiSample.ConsoleBackgroundJob.csproj
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<LangVersion>7.2</LangVersion> | ||
<UserSecretsId>bee0443a-9bf6-45ea-8e8b-f49272936718</UserSecretsId> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.1.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.0" /> | ||
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="3.19.6" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="appsettings.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace Joonasw.AzureAdApiSample.ConsoleBackgroundJob | ||
{ | ||
class Program | ||
{ | ||
static async Task Main(string[] args) | ||
{ | ||
IConfiguration config = CreateConfig(); | ||
JobSettings settings = config.Get<JobSettings>(); | ||
} | ||
|
||
private static IConfiguration CreateConfig() => | ||
new ConfigurationBuilder() | ||
.AddJsonFile("appsettings.json") | ||
.AddUserSecrets<Program>() | ||
.Build(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Joonasw.AzureAdApiSample.ConsoleBackgroundJob/appsettings.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"Authority": "", | ||
"ClientId": "", | ||
"ClientSecret": "", | ||
"ApiResourceUri": "", | ||
"ApiBaseUrl": "http://localhost:2672" | ||
} |
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
Joonasw.AzureAdApiSample.ConsoleNativeClient/ClientSettings.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Joonasw.AzureAdApiSample.ConsoleNativeClient | ||
{ | ||
public class ClientSettings | ||
{ | ||
public string Authority { get; set; } | ||
public string ClientId { get; set; } | ||
public string RedirectUri { get; set; } | ||
public string ApiResourceUri { get; set; } | ||
public string ApiBaseUrl { get; set; } | ||
} | ||
} |
75 changes: 17 additions & 58 deletions
75
....AzureAdApiSample.ConsoleNativeClient/Joonasw.AzureAdApiSample.ConsoleNativeClient.csproj
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,25 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{D3973CD4-097F-4332-8D10-39B3A1F83F47}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<RootNamespace>Joonasw.AzureAdApiSample.ConsoleNativeClient</RootNamespace> | ||
<AssemblyName>Joonasw.AzureAdApiSample.ConsoleNativeClient</AssemblyName> | ||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<TargetFramework>netcoreapp2.1</TargetFramework> | ||
<LangVersion>7.2</LangVersion> | ||
<UserSecretsId>bee0443a-9bf6-45ea-8e8b-f49272936719</UserSecretsId> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory, Version=3.19.6.14301, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.3.19.6\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.Platform, Version=3.19.6.14301, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.3.19.6\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Configuration" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="TodoApiClient.cs" /> | ||
<Compile Include="TodoItem.cs" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.1.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.1.0" /> | ||
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="3.19.6" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="App.config" /> | ||
<None Include="packages.config" /> | ||
<None Update="appsettings.json"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> | ||
|
||
</Project> |
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
36 changes: 0 additions & 36 deletions
36
Joonasw.AzureAdApiSample.ConsoleNativeClient/Properties/AssemblyInfo.cs
This file was deleted.
Oops, something went wrong.
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
7 changes: 7 additions & 0 deletions
7
Joonasw.AzureAdApiSample.ConsoleNativeClient/appsettings.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"Authority": "https://login.microsoftonline.com/yourtenant.onmicrosoft.com", | ||
"ClientId": "application-id-here", | ||
"ApiResourceUri": "https://yourtenant.onmicrosoft.com/some-guid", | ||
"RedirectUri": "https://yourtenant.onmicrosoft.com/TodoClient", | ||
"ApiBaseUrl": "http://localhost:2672" | ||
} |
This file was deleted.
Oops, something went wrong.
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