├── .gitignore ├── LICENSE ├── README.md └── src ├── ScottBrady91.IdentityServer3.Example.sln └── ScottBrady91.IdentityServer3.Example ├── Configuration ├── Cert.cs ├── Clients.cs ├── RelyingParties.cs ├── Scopes.cs ├── Users.cs └── idsrv3test.pfx ├── Properties └── AssemblyInfo.cs ├── ScottBrady91.IdentityServer3.Example.csproj ├── Startup.cs ├── Startup_AspNetIdentity.cs ├── Startup_WsFederation.cs ├── Web.Debug.config ├── Web.Release.config ├── Web.config └── packages.config /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | [Rr]eleases/ 14 | x64/ 15 | x86/ 16 | build/ 17 | bld/ 18 | [Bb]in/ 19 | [Oo]bj/ 20 | 21 | # Roslyn cache directories 22 | *.ide/ 23 | 24 | # MSTest test Results 25 | [Tt]est[Rr]esult*/ 26 | [Bb]uild[Ll]og.* 27 | 28 | #NUNIT 29 | *.VisualState.xml 30 | TestResult.xml 31 | 32 | # Build Results of an ATL Project 33 | [Dd]ebugPS/ 34 | [Rr]eleasePS/ 35 | dlldata.c 36 | 37 | *_i.c 38 | *_p.c 39 | *_i.h 40 | *.ilk 41 | *.meta 42 | *.obj 43 | *.pch 44 | *.pdb 45 | *.pgc 46 | *.pgd 47 | *.rsp 48 | *.sbr 49 | *.tlb 50 | *.tli 51 | *.tlh 52 | *.tmp 53 | *.tmp_proj 54 | *.log 55 | *.vspscc 56 | *.vssscc 57 | .builds 58 | *.pidb 59 | *.svclog 60 | *.scc 61 | 62 | # Chutzpah Test files 63 | _Chutzpah* 64 | 65 | # Visual C++ cache files 66 | ipch/ 67 | *.aps 68 | *.ncb 69 | *.opensdf 70 | *.sdf 71 | *.cachefile 72 | 73 | # Visual Studio profiler 74 | *.psess 75 | *.vsp 76 | *.vspx 77 | 78 | # TFS 2012 Local Workspace 79 | $tf/ 80 | 81 | # Guidance Automation Toolkit 82 | *.gpState 83 | 84 | # ReSharper is a .NET coding add-in 85 | _ReSharper*/ 86 | *.[Rr]e[Ss]harper 87 | *.DotSettings.user 88 | 89 | # JustCode is a .NET coding addin-in 90 | .JustCode 91 | 92 | # TeamCity is a build add-in 93 | _TeamCity* 94 | 95 | # DotCover is a Code Coverage Tool 96 | *.dotCover 97 | 98 | # NCrunch 99 | _NCrunch_* 100 | .*crunch*.local.xml 101 | 102 | # MightyMoose 103 | *.mm.* 104 | AutoTest.Net/ 105 | 106 | # Web workbench (sass) 107 | .sass-cache/ 108 | 109 | # Installshield output folder 110 | [Ee]xpress/ 111 | 112 | # DocProject is a documentation generator add-in 113 | DocProject/buildhelp/ 114 | DocProject/Help/*.HxT 115 | DocProject/Help/*.HxC 116 | DocProject/Help/*.hhc 117 | DocProject/Help/*.hhk 118 | DocProject/Help/*.hhp 119 | DocProject/Help/Html2 120 | DocProject/Help/html 121 | 122 | # Click-Once directory 123 | publish/ 124 | 125 | # Publish Web Output 126 | *.[Pp]ublish.xml 127 | *.azurePubxml 128 | # TODO: Comment the next line if you want to checkin your web deploy settings 129 | # but database connection strings (with potential passwords) will be unencrypted 130 | *.pubxml 131 | *.publishproj 132 | 133 | # NuGet Packages 134 | *.nupkg 135 | # The packages folder can be ignored because of Package Restore 136 | **/packages/* 137 | # except build/, which is used as an MSBuild target. 138 | !**/packages/build/ 139 | # If using the old MSBuild-Integrated Package Restore, uncomment this: 140 | #!**/packages/repositories.config 141 | 142 | # Windows Azure Build Output 143 | csx/ 144 | *.build.csdef 145 | 146 | # Windows Store app package directory 147 | AppPackages/ 148 | 149 | # Others 150 | sql/ 151 | *.Cache 152 | ClientBin/ 153 | [Ss]tyle[Cc]op.* 154 | ~$* 155 | *~ 156 | *.dbmdl 157 | *.dbproj.schemaview 158 | *.publishsettings 159 | node_modules/ 160 | 161 | # RIA/Silverlight projects 162 | Generated_Code/ 163 | 164 | # Backup & report files from converting an old project file 165 | # to a newer Visual Studio version. Backup files are not needed, 166 | # because we have git ;-) 167 | _UpgradeReport_Files/ 168 | Backup*/ 169 | UpgradeLog*.XML 170 | UpgradeLog*.htm 171 | 172 | # SQL Server files 173 | *.mdf 174 | *.ldf 175 | 176 | # Business Intelligence projects 177 | *.rdl.data 178 | *.bim.layout 179 | *.bim_*.settings 180 | 181 | # Microsoft Fakes 182 | FakesAssemblies/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Scott Brady 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Identity Server 3 Standalone Example Implementation 2 | 3 | ## About 4 | Standalone Identity Server 3 implementation referenced on [www.scottbrady91.com](https://www.scottbrady91.com) 5 | 6 | ##Configuration 7 | Use the appSetting owin:AppStartup to switch between OWIN Startup configurations: 8 | 9 | * InMemory: Generic, In-Memory Users as seen in [Identity Server Implementation Guide](https://www.scottbrady91.com/Identity-Server/Identity-Server-3-Standalone-Implementation-Part-1) 10 | * AspNetIdentity: Implementation using ASP.NET Identity User Store as seen in [Identity Server Using ASP.NET Identity](https://www.scottbrady91.com/Identity-Server/Identity-Server-3-using-ASPNET-Identity) 11 | * WsFederation: Implementation using the Identity Server WS-Federation plugin as seen in [Identity Server Using WS-Federation](https://www.scottbrady91.com/Identity-Server/Identity-Server-3-using-WS-Federation) 12 | -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScottBrady91.IdentityServer3.Example", "ScottBrady91.IdentityServer3.Example\ScottBrady91.IdentityServer3.Example.csproj", "{631A6A2C-8930-4EB9-A443-CC7845FEC06D}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {631A6A2C-8930-4EB9-A443-CC7845FEC06D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {631A6A2C-8930-4EB9-A443-CC7845FEC06D}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {631A6A2C-8930-4EB9-A443-CC7845FEC06D}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {631A6A2C-8930-4EB9-A443-CC7845FEC06D}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Configuration/Cert.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Security.Cryptography.X509Certificates; 3 | 4 | namespace ScottBrady91.IdentityServer3.Example.Configuration 5 | { 6 | internal static class Cert 7 | { 8 | public static X509Certificate2 Load() 9 | { 10 | var assembly = typeof(Cert).Assembly; 11 | using (var stream = assembly.GetManifestResourceStream("ScottBrady91.IdentityServer3.Example.Configuration.idsrv3test.pfx")) 12 | { 13 | return new X509Certificate2(ReadStream(stream), "idsrv3test"); 14 | } 15 | } 16 | 17 | private static byte[] ReadStream(Stream input) 18 | { 19 | var buffer = new byte[16 * 1024]; 20 | using (var ms = new MemoryStream()) 21 | { 22 | int read; 23 | while ((read = input.Read(buffer, 0, buffer.Length)) > 0) 24 | { 25 | ms.Write(buffer, 0, read); 26 | } 27 | 28 | return ms.ToArray(); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Configuration/Clients.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using IdentityServer3.Core; 3 | using IdentityServer3.Core.Models; 4 | 5 | namespace ScottBrady91.IdentityServer3.Example.Configuration 6 | { 7 | public static class Clients 8 | { 9 | public static IEnumerable Get() 10 | { 11 | return new List 12 | { 13 | new Client 14 | { 15 | ClientId = @"implicitclient", 16 | ClientName = @"Example Implicit Client", 17 | Enabled = true, 18 | Flow = Flows.Implicit, 19 | RequireConsent = true, 20 | AllowRememberConsent = true, 21 | RedirectUris = new List {"https://localhost:44304/account/signInCallback"}, 22 | PostLogoutRedirectUris = new List {"https://localhost:44304/"}, 23 | AllowedScopes = 24 | new List 25 | { 26 | Constants.StandardScopes.OpenId, 27 | Constants.StandardScopes.Profile, 28 | Constants.StandardScopes.Email 29 | }, 30 | AccessTokenType = AccessTokenType.Jwt 31 | }, 32 | new Client 33 | { 34 | ClientId = @"hybridclient", 35 | ClientName = @"Example Hybrid Client", 36 | ClientSecrets = new List 37 | { 38 | new Secret("idsrv3test".Sha256()) 39 | }, 40 | Enabled = true, 41 | Flow = Flows.Hybrid, 42 | RequireConsent = true, 43 | AllowRememberConsent = true, 44 | RedirectUris = new List 45 | { 46 | "https://localhost:44305/" 47 | }, 48 | PostLogoutRedirectUris = new List 49 | { 50 | "https://localhost:44305/" 51 | }, 52 | AllowedScopes = new List 53 | { 54 | Constants.StandardScopes.OpenId, 55 | Constants.StandardScopes.Profile, 56 | Constants.StandardScopes.Email, 57 | Constants.StandardScopes.Roles, 58 | Constants.StandardScopes.OfflineAccess 59 | }, 60 | AccessTokenType = AccessTokenType.Jwt 61 | } 62 | }; 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Configuration/RelyingParties.cs: -------------------------------------------------------------------------------- 1 | namespace ScottBrady91.IdentityServer3.Example.Configuration 2 | { 3 | using System.Collections.Generic; 4 | using System.Security.Claims; 5 | 6 | using IdentityModel.Constants; 7 | 8 | using global::IdentityServer3.WsFederation.Models; 9 | 10 | public static class RelyingParties 11 | { 12 | public static IEnumerable Get() 13 | { 14 | return new List 15 | { 16 | new RelyingParty 17 | { 18 | Realm = "urn:testClient", 19 | Name = "testclient", 20 | Enabled = true, 21 | ReplyUrl = "https://localhost:4004/TestClient/", 22 | TokenType = TokenTypes.Saml2TokenProfile11, 23 | ClaimMappings = 24 | new Dictionary 25 | { 26 | { "sub", ClaimTypes.NameIdentifier }, 27 | { "name", ClaimTypes.Name }, 28 | { "given_name", ClaimTypes.GivenName }, 29 | { "family_name", ClaimTypes.Surname }, 30 | { "email", ClaimTypes.Email }, 31 | { "upn", ClaimTypes.Upn } 32 | } 33 | } 34 | }; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Configuration/Scopes.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using IdentityServer3.Core.Models; 3 | 4 | namespace ScottBrady91.IdentityServer3.Example.Configuration 5 | { 6 | public static class Scopes 7 | { 8 | public static IEnumerable Get() 9 | { 10 | return new List 11 | { 12 | StandardScopes.OpenId, 13 | StandardScopes.Roles, 14 | StandardScopes.Profile, 15 | StandardScopes.Email, 16 | StandardScopes.OfflineAccess 17 | }; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Configuration/Users.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Security.Claims; 3 | using IdentityServer3.Core; 4 | using IdentityServer3.Core.Services.InMemory; 5 | 6 | namespace ScottBrady91.IdentityServer3.Example.Configuration 7 | { 8 | public static class Users 9 | { 10 | public static List Get() 11 | { 12 | return new List 13 | { 14 | new InMemoryUser 15 | { 16 | Username = "ScottBrady", 17 | Password = "Password123!", 18 | Subject = "1", 19 | Claims = new List 20 | { 21 | new Claim(Constants.ClaimTypes.GivenName, "Scott"), 22 | new Claim(Constants.ClaimTypes.FamilyName, "Brady"), 23 | new Claim(Constants.ClaimTypes.Email, "info@scottbrady91.com"), 24 | new Claim(Constants.ClaimTypes.Role, "Badmin") 25 | } 26 | } 27 | }; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Configuration/idsrv3test.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scottbrady91/IdentityServer3-Example/4c8103344e5d42a9ccd87f6f57921f3b1e5a4ce1/src/ScottBrady91.IdentityServer3.Example/Configuration/idsrv3test.pfx -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ScottBrady91.IdentityServer3.Example")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ScottBrady91.IdentityServer3.Example")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c8bdeab5-df44-4df8-b304-0dc1fc0a98cc")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Revision and Build Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/ScottBrady91.IdentityServer3.Example.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | 8 | 9 | 2.0 10 | {631A6A2C-8930-4EB9-A443-CC7845FEC06D} 11 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 12 | Library 13 | Properties 14 | ScottBrady91.IdentityServer3.Example 15 | ScottBrady91.IdentityServer3.Example 16 | v4.5.1 17 | true 18 | 44300 19 | 20 | 21 | 22 | 23 | 24 | true 25 | full 26 | false 27 | bin\ 28 | DEBUG;TRACE 29 | prompt 30 | 4 31 | 32 | 33 | pdbonly 34 | true 35 | bin\ 36 | TRACE 37 | prompt 38 | 4 39 | 40 | 41 | 42 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll 43 | True 44 | 45 | 46 | ..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll 47 | True 48 | 49 | 50 | ..\packages\IdentityModel.1.11.0\lib\net45\IdentityModel.dll 51 | True 52 | 53 | 54 | ..\packages\IdentityServer3.2.5.0\lib\net45\IdentityServer3.dll 55 | True 56 | 57 | 58 | ..\packages\IdentityServer3.AspNetIdentity.dll.2.0.0\lib\net45\IdentityServer3.AspNetIdentity.dll.dll 59 | True 60 | 61 | 62 | ..\packages\IdentityServer3.WsFederation.2.5.0\lib\net45\IdentityServer3.WsFederation.dll 63 | True 64 | 65 | 66 | ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll 67 | True 68 | 69 | 70 | ..\packages\Microsoft.AspNet.Identity.EntityFramework.2.2.1\lib\net45\Microsoft.AspNet.Identity.EntityFramework.dll 71 | True 72 | 73 | 74 | 75 | ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll 76 | 77 | 78 | ..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll 79 | 80 | 81 | ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll 82 | True 83 | 84 | 85 | ..\packages\Owin.1.0\lib\net40\Owin.dll 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | Designer 111 | 112 | 113 | Always 114 | 115 | 116 | Web.config 117 | 118 | 119 | Web.config 120 | 121 | 122 | 123 | 124 | Designer 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 10.0 141 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | True 151 | True 152 | 60649 153 | / 154 | https://localhost:44300/ 155 | False 156 | False 157 | 158 | 159 | False 160 | 161 | 162 | 163 | 164 | 171 | -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Startup.cs: -------------------------------------------------------------------------------- 1 | using IdentityServer3.Core.Configuration; 2 | using Microsoft.Owin; 3 | using Owin; 4 | using ScottBrady91.IdentityServer3.Example; 5 | using ScottBrady91.IdentityServer3.Example.Configuration; 6 | 7 | [assembly: OwinStartup("InMemory", typeof(Startup))] 8 | 9 | namespace ScottBrady91.IdentityServer3.Example 10 | { 11 | public sealed class Startup 12 | { 13 | public void Configuration(IAppBuilder app) 14 | { 15 | app.Map( 16 | "/core", 17 | coreApp => 18 | { 19 | coreApp.UseIdentityServer(new IdentityServerOptions 20 | { 21 | SiteName = "Standalone Identity Server", 22 | SigningCertificate = Cert.Load(), 23 | Factory = 24 | new IdentityServerServiceFactory() 25 | .UseInMemoryClients(Clients.Get()) 26 | .UseInMemoryScopes(Scopes.Get()) 27 | .UseInMemoryUsers(Users.Get()), 28 | RequireSsl = true, 29 | AuthenticationOptions = new AuthenticationOptions { EnablePostSignOutAutoRedirect = true } 30 | }); 31 | }); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Startup_AspNetIdentity.cs: -------------------------------------------------------------------------------- 1 | using IdentityServer3.Core.Configuration; 2 | using IdentityServer3.Core.Services; 3 | using Microsoft.Owin; 4 | using Owin; 5 | using ScottBrady91.IdentityServer3.Example; 6 | using ScottBrady91.IdentityServer3.Example.Configuration; 7 | 8 | 9 | [assembly: OwinStartup("AspNetIdentity", typeof(Startup_AspNetIdentity))] 10 | 11 | namespace ScottBrady91.IdentityServer3.Example 12 | { 13 | using global::IdentityServer3.AspNetIdentity; 14 | 15 | using Microsoft.AspNet.Identity; 16 | using Microsoft.AspNet.Identity.EntityFramework; 17 | 18 | public sealed class Startup_AspNetIdentity 19 | { 20 | public void Configuration(IAppBuilder app) 21 | { 22 | app.Map( 23 | "/core", 24 | coreApp => 25 | { 26 | var factory = 27 | new IdentityServerServiceFactory() 28 | .UseInMemoryClients(Clients.Get()) 29 | .UseInMemoryScopes(Scopes.Get()); 30 | 31 | factory.Register(new Registration()); 32 | factory.Register(new Registration>()); 33 | factory.Register(new Registration>(x => new UserManager(x.Resolve>()))); 34 | 35 | factory.UserService = new Registration>(); 36 | 37 | coreApp.UseIdentityServer( 38 | new IdentityServerOptions 39 | { 40 | SiteName = "Standalone Identity Server", 41 | SigningCertificate = Cert.Load(), 42 | Factory = factory, 43 | RequireSsl = true 44 | }); 45 | }); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Startup_WsFederation.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | 3 | using ScottBrady91.IdentityServer3.Example; 4 | 5 | [assembly: OwinStartup("WsFederation", typeof(Startup_WsFederation))] 6 | 7 | namespace ScottBrady91.IdentityServer3.Example 8 | { 9 | using System.Collections.Generic; 10 | 11 | using global::IdentityServer3.Core.Configuration; 12 | using global::IdentityServer3.WsFederation.Configuration; 13 | using global::IdentityServer3.WsFederation.Models; 14 | using global::IdentityServer3.WsFederation.Services; 15 | 16 | using Owin; 17 | 18 | using ScottBrady91.IdentityServer3.Example.Configuration; 19 | 20 | public sealed class Startup_WsFederation 21 | { 22 | public void Configuration(IAppBuilder app) 23 | { 24 | app.Map( 25 | "/core", 26 | coreApp => 27 | { 28 | coreApp.UseIdentityServer( 29 | new IdentityServerOptions 30 | { 31 | SiteName = "Standalone Identity Server", 32 | SigningCertificate = Cert.Load(), 33 | Factory = 34 | new IdentityServerServiceFactory().UseInMemoryClients(Clients.Get()) 35 | .UseInMemoryScopes(Scopes.Get()) 36 | .UseInMemoryUsers(Users.Get()), 37 | RequireSsl = true, 38 | PluginConfiguration = ConfigureWsFederation 39 | }); 40 | }); 41 | } 42 | 43 | private void ConfigureWsFederation(IAppBuilder pluginApp, IdentityServerOptions options) 44 | { 45 | var factory = new WsFederationServiceFactory(options.Factory); 46 | factory.Register(new Registration>(RelyingParties.Get())); 47 | factory.RelyingPartyService = new Registration(typeof(InMemoryRelyingPartyService)); 48 | pluginApp.UseWsFederationPlugin(new WsFederationPluginOptions { IdentityServerOptions = options, Factory = factory }); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/Web.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/ScottBrady91.IdentityServer3.Example/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | --------------------------------------------------------------------------------