Skip to content

Commit 79b5881

Browse files
committed
Ticket 3 : Initialize the API
1 parent 8cc8ffb commit 79b5881

30 files changed

+19969
-262
lines changed
Binary file not shown.

SimpleIdentityServer.WebSite.Api.sln

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.23107.0
5+
MinimumVisualStudioVersion = 10.0.40219.1

global.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"projects": [
3+
"src",
4+
"tests"
5+
],
6+
"sdk": {
7+
"version": "1.0.0-rc1-update1",
8+
"runtime": "clr",
9+
"architecture": "x86"
10+
}
11+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>d278bea2-cdef-404a-bdd8-b79974282939</ProjectGuid>
10+
<RootNamespace>SimpleIdentityServer.WebSite.Api.Core</RootNamespace>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
13+
</PropertyGroup>
14+
<PropertyGroup>
15+
<SchemaVersion>2.0</SchemaVersion>
16+
</PropertyGroup>
17+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
18+
<ProjectExtensions>
19+
<VisualStudio>
20+
<UserProperties project_1json__JSONSchema="" />
21+
</VisualStudio>
22+
</ProjectExtensions>
23+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "1.0.0-*",
3+
"description": "SimpleIdentityServer.WebSite.Api.Core Class Library",
4+
"authors": [ "Thierry Habart" ],
5+
"tags": [ "" ],
6+
"projectUrl": "",
7+
"licenseUrl": "",
8+
9+
"dependencies": {
10+
},
11+
12+
"tooling": {
13+
"defaultNamespace": "SimpleIdentityServer.WebSite.Api.Core"
14+
},
15+
16+
"frameworks": {
17+
"dnx451": {},
18+
"dnxcore50": { }
19+
}
20+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#region copyright
2+
// Copyright 2015 Habart Thierry
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
#endregion
16+
17+
namespace SimpleIdentityServer.WebSite.Api.Host
18+
{
19+
public static class Constants
20+
{
21+
public static class RouteValues
22+
{
23+
public const string Root = "api";
24+
25+
public const string Docker = Root + "/dockers";
26+
}
27+
}
28+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#region copyright
2+
// Copyright 2015 Habart Thierry
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
#endregion
16+
17+
using System.Collections.Generic;
18+
using Microsoft.AspNet.Mvc;
19+
20+
namespace SimpleIdentityServer.WebSite.Api.Host.Controllers
21+
{
22+
[Route(Constants.RouteValues.Docker)]
23+
public class DockersController : Controller
24+
{
25+
// GET: api/values
26+
[HttpGet]
27+
public IEnumerable<string> Get()
28+
{
29+
return new string[] { "value1", "value2" };
30+
}
31+
32+
// GET api/values/5
33+
[HttpGet("{id}")]
34+
public string Get(int id)
35+
{
36+
return "value";
37+
}
38+
39+
// POST api/values
40+
[HttpPost]
41+
public void Post([FromBody]string value)
42+
{
43+
}
44+
45+
// PUT api/values/5
46+
[HttpPut("{id}")]
47+
public void Put(int id, [FromBody]string value)
48+
{
49+
}
50+
51+
// DELETE api/values/5
52+
[HttpDelete("{id}")]
53+
public void Delete(int id)
54+
{
55+
}
56+
}
57+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>f6cdd355-9d4a-4a57-8d57-74f2dbcdbfa3</ProjectGuid>
10+
<RootNamespace>SimpleIdentityServer.WebSite.Api.Host</RootNamespace>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
13+
</PropertyGroup>
14+
<PropertyGroup>
15+
<SchemaVersion>2.0</SchemaVersion>
16+
</PropertyGroup>
17+
<ItemGroup>
18+
<DnxInvisibleFolder Include="Extensions\" />
19+
</ItemGroup>
20+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
21+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#region copyright
2+
// Copyright 2015 Habart Thierry
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
#endregion
16+
17+
using Microsoft.AspNet.Builder;
18+
using Microsoft.AspNet.Hosting;
19+
using Microsoft.Extensions.Configuration;
20+
using Microsoft.Extensions.DependencyInjection;
21+
using Microsoft.Extensions.Logging;
22+
using Microsoft.Extensions.PlatformAbstractions;
23+
24+
namespace SimpleIdentityServer.WebSite.Api.Host
25+
{
26+
public class Startup
27+
{
28+
#region Properties
29+
30+
public IConfigurationRoot Configuration { get; set; }
31+
32+
#endregion
33+
34+
#region Public methods
35+
36+
public Startup(IHostingEnvironment env,
37+
IApplicationEnvironment appEnv)
38+
{
39+
// Load all the configuration information from the "json" file & the environment variables.
40+
var builder = new ConfigurationBuilder()
41+
.AddJsonFile("appsettings.json")
42+
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
43+
.AddEnvironmentVariables();
44+
Configuration = builder.Build();
45+
}
46+
47+
public void ConfigureServices(IServiceCollection services)
48+
{
49+
services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin()
50+
.AllowAnyMethod()
51+
.AllowAnyHeader()));
52+
services.AddLogging();
53+
services.AddMvc();
54+
}
55+
56+
public void Configure(IApplicationBuilder app,
57+
IHostingEnvironment env,
58+
ILoggerFactory loggerFactory)
59+
{
60+
loggerFactory.AddConsole();
61+
app.UseCors("AllowAll");
62+
app.UseMvc(routes =>
63+
{
64+
routes.MapRoute(
65+
name: "default",
66+
template: "{controller}/{action}/{id?}");
67+
});
68+
}
69+
70+
#endregion
71+
72+
#region Public static methods
73+
74+
// Entry point for the application.
75+
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
76+
77+
#endregion
78+
}
79+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Logging": {
3+
"IncludeScopes": false,
4+
"LogLevel": {
5+
"Default": "Verbose",
6+
"System": "Information",
7+
"Microsoft": "Information"
8+
}
9+
}
10+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"version": "1.0.0-*",
3+
"description": "SimpleIdentityServer.WebSite.Api.Host Class Library",
4+
"authors": [ "Thierry Habart" ],
5+
"tags": [ "" ],
6+
"projectUrl": "",
7+
"licenseUrl": "",
8+
9+
"compilationOptions": {
10+
"emitEntryPoint": true
11+
},
12+
13+
"dependencies": {
14+
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
15+
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
16+
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
17+
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
18+
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
19+
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
20+
"Microsoft.Dnx.Runtime": "1.0.0-rc1-final",
21+
"Microsoft.Extensions.Primitives": "1.0.0-rc1-final",
22+
"Microsoft.Dnx.Watcher": "1.0.0-rc1-final",
23+
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
24+
"Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
25+
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
26+
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
27+
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
28+
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
29+
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
30+
"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final"
31+
},
32+
33+
"commands": {
34+
"web": "Microsoft.AspNet.Server.Kestrel --server.urls http://0.0.0.0:5000"
35+
},
36+
37+
"tooling": {
38+
"defaultNamespace": "SimpleIdentityServer.Manager.Core"
39+
},
40+
41+
"frameworks": {
42+
"dnx451": {},
43+
"dnxcore50": { }
44+
}
45+
}

0 commit comments

Comments
 (0)