Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
adding files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Crowley committed Mar 14, 2016
1 parent 4a93b39 commit 31a34ab
Show file tree
Hide file tree
Showing 67 changed files with 28,585 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Microsoft-Graph-ExcelRest-ToDo.sln
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft-Graph-ExcelRest-ToDo", "Microsoft-Graph-ExcelRest-ToDo\Microsoft-Graph-ExcelRest-ToDo.csproj", "{7E86C505-414C-4D01-8DC3-940DCEEFD956}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E86C505-414C-4D01-8DC3-940DCEEFD956}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E86C505-414C-4D01-8DC3-940DCEEFD956}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E86C505-414C-4D01-8DC3-940DCEEFD956}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E86C505-414C-4D01-8DC3-940DCEEFD956}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
31 changes: 31 additions & 0 deletions Microsoft-Graph-ExcelRest-ToDo/App_Start/BundleConfig.cs
@@ -0,0 +1,31 @@
using System.Web;
using System.Web.Optimization;

namespace Microsoft_Graph_ExcelRest_ToDo
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));

// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));

bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
13 changes: 13 additions & 0 deletions Microsoft-Graph-ExcelRest-ToDo/App_Start/FilterConfig.cs
@@ -0,0 +1,13 @@
using System.Web;
using System.Web.Mvc;

namespace Microsoft_Graph_ExcelRest_ToDo
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}
23 changes: 23 additions & 0 deletions Microsoft-Graph-ExcelRest-ToDo/App_Start/RouteConfig.cs
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Microsoft_Graph_ExcelRest_ToDo
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
Binary file added Microsoft-Graph-ExcelRest-ToDo/Assets/ToDo.xlsx
Binary file not shown.
54 changes: 54 additions & 0 deletions Microsoft-Graph-ExcelRest-ToDo/Auth/AuthHelper.cs
@@ -0,0 +1,54 @@
using System.Threading.Tasks;
using System.Web;
using Microsoft_Graph_ExcelRest_ToDo.TokenStorage;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.OpenIdConnect;

namespace Microsoft_Graph_ExcelRest_ToDo.Auth
{
public class AuthHelper
{
// This is the logon authority
// i.e. https://login.microsoftonline.com/common
public string Authority { get; set; }
// This is the application ID obtained from registering at
// https://apps.dev.microsoft.com
public string AppId { get; set; }
// This is the application secret obtained from registering at
// https://apps.dev.microsoft.com
public string AppSecret { get; set; }
// This is the token cache
public SessionTokenCache TokenCache { get; set; }

public AuthHelper(string authority, string appId, string appSecret, SessionTokenCache tokenCache)
{
Authority = authority;
AppId = appId;
AppSecret = appSecret;
TokenCache = tokenCache;
}

public async Task<string> GetUserAccessToken(string redirectUri)
{
AuthenticationContext authContext = new AuthenticationContext(Authority, false, TokenCache);

ClientCredential credential = new ClientCredential(AppId, AppSecret);

try
{
AuthenticationResult authResult = await authContext.AcquireTokenSilentAsync("https://graph.microsoft.com", credential,
new UserIdentifier(TokenCache.UserObjectId, UserIdentifierType.UniqueId));
return authResult.AccessToken;
}
catch (AdalSilentTokenAcquisitionException)
{
HttpContext.Current.Request.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties() { RedirectUri = redirectUri },
OpenIdConnectAuthenticationDefaults.AuthenticationType);

return null;
}
}
}
}
17 changes: 17 additions & 0 deletions Microsoft-Graph-ExcelRest-ToDo/Content/Site.css
@@ -0,0 +1,17 @@
body {
padding-top: 50px;
padding-bottom: 20px;
}

/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}

/* Override the default bootstrap behavior where horizontal description lists
will truncate terms that are too long to fit in the left column
*/
.dl-horizontal dt {
white-space: normal;
}

0 comments on commit 31a34ab

Please sign in to comment.