();
52 |
53 | if (Session["realmId"] != null)
54 | {
55 | claims.Add(new Claim("realmId", Session["realmId"].ToString()));
56 | }
57 |
58 | if (!string.IsNullOrWhiteSpace(tokenResponse.AccessToken))
59 | {
60 | claims.Add(new Claim("access_token", tokenResponse.AccessToken));
61 | claims.Add(new Claim("access_token_expires_at", (DateTime.Now.AddSeconds(tokenResponse.AccessTokenExpiresIn)).ToString()));
62 | }
63 |
64 | if (!string.IsNullOrWhiteSpace(tokenResponse.RefreshToken))
65 | {
66 | claims.Add(new Claim("refresh_token", tokenResponse.RefreshToken));
67 | claims.Add(new Claim("refresh_token_expires_at", (DateTime.Now.AddSeconds(tokenResponse.RefreshTokenExpiresIn)).ToString()));
68 | }
69 |
70 | var id = new ClaimsIdentity(claims, "Cookies");
71 | Request.GetOwinContext().Authentication.SignIn(id);
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/MvcCodeFlowClientManual/Global.asax:
--------------------------------------------------------------------------------
1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MvcCodeFlowClientManual.MvcApplication" Language="C#" %>
2 |
--------------------------------------------------------------------------------
/MvcCodeFlowClientManual/Global.asax.cs:
--------------------------------------------------------------------------------
1 | using System.Web.Mvc;
2 | using System.Web.Optimization;
3 | using System.Web.Routing;
4 |
5 | namespace MvcCodeFlowClientManual
6 | {
7 | public class MvcApplication : System.Web.HttpApplication
8 | {
9 | protected void Application_Start()
10 | {
11 | AreaRegistration.RegisterAllAreas();
12 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
13 | RouteConfig.RegisterRoutes(RouteTable.Routes);
14 | BundleConfig.RegisterBundles(BundleTable.Bundles);
15 | }
16 |
17 | void Application_EndRequest(object sender, System.EventArgs e)
18 | {
19 | // If the user is not authorised to see this page or access this function, send them to the error page.
20 | if (Response.StatusCode == 401)
21 | {
22 | Response.ClearContent();
23 | Response.RedirectToRoute("ErrorHandler", (RouteTable.Routes["ErrorHandler"] as Route).Defaults);
24 | }
25 | }
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/MvcCodeFlowClientManual/MVC Manual Code Flow Client.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Debug
8 | AnyCPU
9 |
10 |
11 | 2.0
12 | {C67DB8BB-6083-436D-9748-4BDD9EC8C0EB}
13 | {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
14 | Library
15 | Properties
16 | MvcCodeFlowClientManual
17 | MvcCodeFlowClientManual
18 | v4.6.1
19 | false
20 | true
21 | 44312
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | 2.5
31 |
32 |
33 | true
34 | full
35 | false
36 | bin\
37 | DEBUG;TRACE
38 | prompt
39 | 4
40 |
41 |
42 | pdbonly
43 | true
44 | bin\
45 | TRACE
46 | prompt
47 | 4
48 |
49 |
50 |
51 | packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll
52 |
53 |
54 | packages\DevDefined.OAuth.0.2\lib\DevDefined.OAuth.dll
55 |
56 |
57 | packages\IdentityModel.3.10.6\lib\net452\IdentityModel.dll
58 |
59 |
60 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.Core.dll
61 |
62 |
63 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.Data.dll
64 |
65 |
66 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.DataService.dll
67 |
68 |
69 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.Diagnostics.dll
70 |
71 |
72 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.EntitlementService.dll
73 |
74 |
75 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.Exception.dll
76 |
77 |
78 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.GlobalTaxService.dll
79 |
80 |
81 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.OAuth2PlatformClient.dll
82 |
83 |
84 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.QueryFilter.dll
85 |
86 |
87 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.ReportService.dll
88 |
89 |
90 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.Retry.dll
91 |
92 |
93 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.Security.dll
94 |
95 |
96 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.Utility.dll
97 |
98 |
99 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\Intuit.Ipp.WebHooksService.dll
100 |
101 |
102 | packages\IppDotNetSdkForQuickBooksApiV3.7.5.1-beta\lib\net461\IppDotNetSdkForQuickBooksApiV3.dll
103 |
104 |
105 |
106 | packages\Microsoft.IdentityModel.JsonWebTokens.5.4.0\lib\net461\Microsoft.IdentityModel.JsonWebTokens.dll
107 |
108 |
109 | packages\Microsoft.IdentityModel.Logging.5.4.0\lib\net461\Microsoft.IdentityModel.Logging.dll
110 |
111 |
112 | packages\Microsoft.IdentityModel.Tokens.5.4.0\lib\net461\Microsoft.IdentityModel.Tokens.dll
113 |
114 |
115 | packages\Microsoft.Owin.4.0.1\lib\net45\Microsoft.Owin.dll
116 |
117 |
118 | packages\Microsoft.Owin.Host.SystemWeb.4.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll
119 |
120 |
121 | packages\Microsoft.Owin.Security.4.0.1\lib\net45\Microsoft.Owin.Security.dll
122 |
123 |
124 | packages\Microsoft.Owin.Security.Cookies.4.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll
125 |
126 |
127 | packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll
128 | True
129 |
130 |
131 | packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll
132 |
133 |
134 | packages\Owin.1.0\lib\net40\Owin.dll
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 | packages\System.IdentityModel.Tokens.Jwt.5.4.0\lib\net461\System.IdentityModel.Tokens.Jwt.dll
144 |
145 |
146 |
147 |
148 |
149 | packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll
150 |
151 |
152 | packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll
153 |
154 |
155 | packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll
156 |
157 |
158 | packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll
159 |
160 |
161 | packages\System.Text.Encodings.Web.4.5.0\lib\netstandard2.0\System.Text.Encodings.Web.dll
162 |
163 |
164 | packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 | packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll
175 |
176 |
177 | packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll
178 |
179 |
180 | packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll
181 |
182 |
183 | packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll
184 |
185 |
186 |
187 | packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll
188 |
189 |
190 | packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll
191 |
192 |
193 | packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 | packages\WebGrease.1.6.0\lib\WebGrease.dll
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 | Global.asax
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 | Designer
271 |
272 |
273 | Web.config
274 |
275 |
276 | Web.config
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 | Designer
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 | 10.0
316 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 | False
330 | True
331 | 27353
332 | /
333 | http://localhost:27353/
334 | False
335 | False
336 |
337 |
338 | False
339 |
340 |
341 |
342 |
343 |
344 |
345 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
346 |
347 |
348 |
349 |
355 |
--------------------------------------------------------------------------------
/MvcCodeFlowClientManual/MVC Manual Code Flow Client.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVC Manual Code Flow Client", "MVC Manual Code Flow Client.csproj", "{C67DB8BB-6083-436D-9748-4BDD9EC8C0EB}"
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 | {C67DB8BB-6083-436D-9748-4BDD9EC8C0EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {C67DB8BB-6083-436D-9748-4BDD9EC8C0EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {C67DB8BB-6083-436D-9748-4BDD9EC8C0EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {C67DB8BB-6083-436D-9748-4BDD9EC8C0EB}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/MvcCodeFlowClientManual/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 |
4 | // General Information about an assembly is controlled through the following
5 | // set of attributes. Change these attribute values to modify the information
6 | // associated with an assembly.
7 | [assembly: AssemblyTitle("MvcCodeFlowClientManual")]
8 | [assembly: AssemblyDescription("")]
9 | [assembly: AssemblyConfiguration("")]
10 | [assembly: AssemblyCompany("")]
11 | [assembly: AssemblyProduct("MvcCodeFlowClientManual")]
12 | [assembly: AssemblyCopyright("Copyright © 2014")]
13 | [assembly: AssemblyTrademark("")]
14 | [assembly: AssemblyCulture("")]
15 |
16 | // Setting ComVisible to false makes the types in this assembly not visible
17 | // to COM components. If you need to access a type in this assembly from
18 | // COM, set the ComVisible attribute to true on that type.
19 | [assembly: ComVisible(false)]
20 |
21 | // The following GUID is for the ID of the typelib if this project is exposed to COM
22 | [assembly: Guid("c955b986-8715-42e1-9f26-c75248466268")]
23 |
24 | // Version information for an assembly consists of the following four values:
25 | //
26 | // Major Version
27 | // Minor Version
28 | // Build Number
29 | // Revision
30 | //
31 | // You can specify all the values or you can default the Revision and Build Numbers
32 | // by using the '*' as shown below:
33 | [assembly: AssemblyVersion("1.0.0.0")]
34 | [assembly: AssemblyFileVersion("1.0.0.0")]
35 |
--------------------------------------------------------------------------------
/MvcCodeFlowClientManual/Scripts/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | Popper.js
4 |
5 |
6 | A library used to position poppers in web applications.
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | ## Wut? Poppers?
24 |
25 | A popper is an element on the screen which "pops out" from the natural flow of your application.
26 | Common examples of poppers are tooltips, popovers and drop-downs.
27 |
28 |
29 | ## So, yet another tooltip library?
30 |
31 | Well, basically, **no**.
32 | Popper.js is a **positioning engine**, its purpose is to calculate the position of an element
33 | to make it possible to position it near a given reference element.
34 |
35 | The engine is completely modular and most of its features are implemented as **modifiers**
36 | (similar to middlewares or plugins).
37 | The whole code base is written in ES2015 and its features are automatically tested on real browsers thanks to [SauceLabs](https://saucelabs.com/) and [TravisCI](https://travis-ci.org/).
38 |
39 | Popper.js has zero dependencies. No jQuery, no LoDash, nothing.
40 | It's used by big companies like [Twitter in Bootstrap v4](https://getbootstrap.com/), [Microsoft in WebClipper](https://github.com/OneNoteDev/WebClipper) and [Atlassian in AtlasKit](https://aui-cdn.atlassian.com/atlaskit/registry/).
41 |
42 | ### Popper.js
43 |
44 | This is the engine, the library that computes and, optionally, applies the styles to
45 | the poppers.
46 |
47 | Some of the key points are:
48 |
49 | - Position elements keeping them in their original DOM context (doesn't mess with your DOM!);
50 | - Allows to export the computed informations to integrate with React and other view libraries;
51 | - Supports Shadow DOM elements;
52 | - Completely customizable thanks to the modifiers based structure;
53 |
54 | Visit our [project page](https://fezvrasta.github.io/popper.js) to see a lot of examples of what you can do with Popper.js!
55 |
56 | Find [the documentation here](/docs/_includes/popper-documentation.md).
57 |
58 |
59 | ### Tooltip.js
60 |
61 | Since lots of users just need a simple way to integrate powerful tooltips in their projects,
62 | we created **Tooltip.js**.
63 | It's a small library that makes it easy to automatically create tooltips using as engine Popper.js.
64 | Its API is almost identical to the famous tooltip system of Bootstrap, in this way it will be
65 | easy to integrate it in your projects.
66 | The tooltips generated by Tooltip.js are accessible thanks to the `aria` tags.
67 |
68 | Find [the documentation here](/docs/_includes/tooltip-documentation.md).
69 |
70 |
71 | ## Installation
72 | Popper.js is available on the following package managers and CDNs:
73 |
74 | | Source | |
75 | |:-------|:---------------------------------------------------------------------------------|
76 | | npm | `npm install popper.js --save` |
77 | | yarn | `yarn add popper.js` |
78 | | NuGet | `PM> Install-Package popper.js` |
79 | | Bower | `bower install popper.js --save` |
80 | | unpkg | [`https://unpkg.com/popper.js`](https://unpkg.com/popper.js) |
81 | | cdnjs | [`https://cdnjs.com/libraries/popper.js`](https://cdnjs.com/libraries/popper.js) |
82 |
83 | Tooltip.js as well:
84 |
85 | | Source | |
86 | |:-------|:---------------------------------------------------------------------------------|
87 | | npm | `npm install tooltip.js --save` |
88 | | yarn | `yarn add tooltip.js` |
89 | | Bower* | `bower install tooltip.js=https://unpkg.com/tooltip.js --save` |
90 | | unpkg | [`https://unpkg.com/tooltip.js`](https://unpkg.com/tooltip.js) |
91 | | cdnjs | [`https://cdnjs.com/libraries/popper.js`](https://cdnjs.com/libraries/popper.js) |
92 |
93 | \*: Bower isn't officially supported, it can be used to install Tooltip.js only trough the unpkg.com CDN. This method has the limitation of not being able to define a specific version of the library. Bower and Popper.js suggests to use npm or Yarn for your projects.
94 | For more info, [read the related issue](https://github.com/FezVrasta/popper.js/issues/390).
95 |
96 | ### Dist targets
97 |
98 | Popper.js is currently shipped with 3 targets in mind: UMD, ESM and ESNext.
99 |
100 | - UMD - Universal Module Definition: AMD, RequireJS and globals;
101 | - ESM - ES Modules: For webpack/Rollup or browser supporting the spec;
102 | - ESNext: Available in `dist/`, can be used with webpack and `babel-preset-env`;
103 |
104 | Make sure to use the right one for your needs. If you want to import it with a `