Skip to content

Commit 72c2c99

Browse files
adding dotnetcore sample (#379)
Co-authored-by: Shane Weaver <[email protected]>
1 parent 3d7bc80 commit 72c2c99

34 files changed

+1693
-0
lines changed
Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
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+
*.userosscache
8+
*.sln.docstates
9+
10+
# User-specific files (MonoDevelop/Xamarin Studio)
11+
*.userprefs
12+
13+
# Build results
14+
[Dd]ebug/
15+
[Dd]ebugPublic/
16+
[Rr]elease/
17+
[Rr]eleases/
18+
x64/
19+
x86/
20+
bld/
21+
[Bb]in/
22+
[Oo]bj/
23+
[Ll]og/
24+
25+
# Visual Studio 2015 cache/options directory
26+
.vs/
27+
# Uncomment if you have tasks that create the project's static files in wwwroot
28+
#wwwroot/
29+
30+
# MSTest test Results
31+
[Tt]est[Rr]esult*/
32+
[Bb]uild[Ll]og.*
33+
34+
# NUNIT
35+
*.VisualState.xml
36+
TestResult.xml
37+
38+
# Build Results of an ATL Project
39+
[Dd]ebugPS/
40+
[Rr]eleasePS/
41+
dlldata.c
42+
43+
# DNX
44+
project.lock.json
45+
project.fragment.lock.json
46+
artifacts/
47+
48+
*_i.c
49+
*_p.c
50+
*_i.h
51+
*.ilk
52+
*.meta
53+
*.obj
54+
*.pch
55+
*.pdb
56+
*.pgc
57+
*.pgd
58+
*.rsp
59+
*.sbr
60+
*.tlb
61+
*.tli
62+
*.tlh
63+
*.tmp
64+
*.tmp_proj
65+
*.log
66+
*.vspscc
67+
*.vssscc
68+
.builds
69+
*.pidb
70+
*.svclog
71+
*.scc
72+
73+
# Chutzpah Test files
74+
_Chutzpah*
75+
76+
# Visual C++ cache files
77+
ipch/
78+
*.aps
79+
*.ncb
80+
*.opendb
81+
*.opensdf
82+
*.sdf
83+
*.cachefile
84+
*.VC.db
85+
*.VC.VC.opendb
86+
87+
# Visual Studio profiler
88+
*.psess
89+
*.vsp
90+
*.vspx
91+
*.sap
92+
93+
# TFS 2012 Local Workspace
94+
$tf/
95+
96+
# Guidance Automation Toolkit
97+
*.gpState
98+
99+
# ReSharper is a .NET coding add-in
100+
_ReSharper*/
101+
*.[Rr]e[Ss]harper
102+
*.DotSettings.user
103+
104+
# JustCode is a .NET coding add-in
105+
.JustCode
106+
107+
# TeamCity is a build add-in
108+
_TeamCity*
109+
110+
# DotCover is a Code Coverage Tool
111+
*.dotCover
112+
113+
# Visual Studio code coverage results
114+
*.coverage
115+
*.coveragexml
116+
117+
# NCrunch
118+
_NCrunch_*
119+
.*crunch*.local.xml
120+
nCrunchTemp_*
121+
122+
# MightyMoose
123+
*.mm.*
124+
AutoTest.Net/
125+
126+
# Web workbench (sass)
127+
.sass-cache/
128+
129+
# Installshield output folder
130+
[Ee]xpress/
131+
132+
# DocProject is a documentation generator add-in
133+
DocProject/buildhelp/
134+
DocProject/Help/*.HxT
135+
DocProject/Help/*.HxC
136+
DocProject/Help/*.hhc
137+
DocProject/Help/*.hhk
138+
DocProject/Help/*.hhp
139+
DocProject/Help/Html2
140+
DocProject/Help/html
141+
142+
# Click-Once directory
143+
publish/
144+
145+
# Publish Web Output
146+
*.[Pp]ublish.xml
147+
*.azurePubxml
148+
# TODO: Comment the next line if you want to checkin your web deploy settings
149+
# but database connection strings (with potential passwords) will be unencrypted
150+
*.pubxml
151+
*.publishproj
152+
153+
# Microsoft Azure Web App publish settings. Comment the next line if you want to
154+
# checkin your Azure Web App publish settings, but sensitive information contained
155+
# in these scripts will be unencrypted
156+
PublishScripts/
157+
158+
# NuGet Packages
159+
*.nupkg
160+
# The packages folder can be ignored because of Package Restore
161+
**/packages/*
162+
# except build/, which is used as an MSBuild target.
163+
!**/packages/build/
164+
# Uncomment if necessary however generally it will be regenerated when needed
165+
#!**/packages/repositories.config
166+
# NuGet v3's project.json files produces more ignoreable files
167+
*.nuget.props
168+
*.nuget.targets
169+
170+
# Microsoft Azure Build Output
171+
csx/
172+
*.build.csdef
173+
174+
# Microsoft Azure Emulator
175+
ecf/
176+
rcf/
177+
178+
# Windows Store app package directories and files
179+
AppPackages/
180+
BundleArtifacts/
181+
Package.StoreAssociation.xml
182+
_pkginfo.txt
183+
184+
# Visual Studio cache files
185+
# files ending in .cache can be ignored
186+
*.[Cc]ache
187+
# but keep track of directories ending in .cache
188+
!*.[Cc]ache/
189+
190+
# Others
191+
ClientBin/
192+
~$*
193+
*~
194+
*.dbmdl
195+
*.dbproj.schemaview
196+
*.jfm
197+
*.pfx
198+
*.publishsettings
199+
node_modules/
200+
orleans.codegen.cs
201+
202+
# Since there are multiple workflows, uncomment next line to ignore bower_components
203+
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
204+
#bower_components/
205+
206+
# RIA/Silverlight projects
207+
Generated_Code/
208+
209+
# Backup & report files from converting an old project file
210+
# to a newer Visual Studio version. Backup files are not needed,
211+
# because we have git ;-)
212+
_UpgradeReport_Files/
213+
Backup*/
214+
UpgradeLog*.XML
215+
UpgradeLog*.htm
216+
217+
# SQL Server files
218+
*.mdf
219+
*.ldf
220+
221+
# Business Intelligence projects
222+
*.rdl.data
223+
*.bim.layout
224+
*.bim_*.settings
225+
226+
# Microsoft Fakes
227+
FakesAssemblies/
228+
229+
# GhostDoc plugin setting file
230+
*.GhostDoc.xml
231+
232+
# Node.js Tools for Visual Studio
233+
.ntvs_analysis.dat
234+
235+
# Visual Studio 6 build log
236+
*.plg
237+
238+
# Visual Studio 6 workspace options file
239+
*.opt
240+
241+
# Visual Studio LightSwitch build output
242+
**/*.HTMLClient/GeneratedArtifacts
243+
**/*.DesktopClient/GeneratedArtifacts
244+
**/*.DesktopClient/ModelManifest.xml
245+
**/*.Server/GeneratedArtifacts
246+
**/*.Server/ModelManifest.xml
247+
_Pvt_Extensions
248+
249+
# Paket dependency manager
250+
.paket/paket.exe
251+
paket-files/
252+
253+
# FAKE - F# Make
254+
.fake/
255+
256+
# JetBrains Rider
257+
.idea/
258+
*.sln.iml
259+
260+
# CodeRush
261+
.cr/
262+
263+
# Python Tools for Visual Studio (PTVS)
264+
__pycache__/
265+
*.pyc
266+
267+
# Cake - Uncomment if you are using it
268+
# tools/
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
3+
* See LICENSE in the source repository root for complete license information.
4+
*/
5+
6+
using Microsoft.AspNetCore.Authentication;
7+
using Microsoft.AspNetCore.Authentication.Cookies;
8+
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
9+
using Microsoft.AspNetCore.Mvc;
10+
11+
namespace MicrosoftGraphAspNetCoreConnectSample.Controllers
12+
{
13+
[Route("[controller]/[action]")]
14+
public class AccountController : Controller
15+
{
16+
[HttpGet]
17+
public IActionResult SignIn()
18+
{
19+
var redirectUrl = Url.Action(nameof(HomeController.Index), "Home");
20+
return Challenge(
21+
new AuthenticationProperties { RedirectUri = redirectUrl },
22+
OpenIdConnectDefaults.AuthenticationScheme);
23+
}
24+
25+
[HttpGet]
26+
public IActionResult SignOut()
27+
{
28+
var callbackUrl = Url.Action(nameof(SignedOut), "Account", values: null, protocol: Request.Scheme);
29+
return SignOut(
30+
new AuthenticationProperties { RedirectUri = callbackUrl },
31+
CookieAuthenticationDefaults.AuthenticationScheme,
32+
OpenIdConnectDefaults.AuthenticationScheme);
33+
}
34+
35+
[HttpGet]
36+
public IActionResult SignedOut()
37+
{
38+
if (User.Identity.IsAuthenticated)
39+
{
40+
// Redirect to home page if the user is authenticated.
41+
return RedirectToAction(nameof(HomeController.Index), "Home");
42+
}
43+
44+
return View();
45+
}
46+
47+
[HttpGet]
48+
public IActionResult AccessDenied()
49+
{
50+
return View();
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)