Skip to content

Instantly share code, notes, and snippets.

View andrewconnell's full-sized avatar
📺
Building courses for @Voitanos

Andrew Connell andrewconnell

📺
Building courses for @Voitanos
View GitHub Profile
@andrewconnell
andrewconnell / _LoginPartial.cshtml
Created December 17, 2014 15:50
Azure AD & ASP.NET MVC - Walk-Through Implementing ADAL & OWIN - _LoginPartial.cshtml
@if (Request.IsAuthenticated) {
<text>
<ul class="nav navbar-nav navbar-right">
<li class="navbar-text">
Hello, @User.Identity.Name!
</li>
<li>
@Html.ActionLink("Sign out", "SignOut", "Account")
</li>
</ul>
@andrewconnell
andrewconnell / CreateTrustedSecurityTokenIssuer.ps1
Created December 20, 2014 11:07
SharePoint Hosted Apps S2S - Create Trusted Security Token Issuer
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$issuerID = "11111111-1111-1111-1111-111111111111"
$targetSiteUrl = "http://wingtipserver"
$targetSite = Get-SPSite $targetSiteUrl
$realm = Get-SPAuthenticationRealm -ServiceContext $targetSite
$registeredIssuerName = $issuerID + '@' + $realm
@andrewconnell
andrewconnell / CreateTestCertificateForS2STrust.ps1
Created December 20, 2014 11:08
SharePoint Hosted Apps S2S - Create Self-Signed Certificate for SharePoint App Server
$makecert = "C:\Program Files\Microsoft Office Servers\15.0\Tools\makecert.exe"
$certmgr = "C:\Program Files\Microsoft Office Servers\15.0\Tools\certmgr.exe"
# specify domain name for SSL certificate
$domain = "appserver.wingtip.com"
# create output directory to create SSL certificate file
$outputDirectory = "c:\Certs\"
New-Item $outputDirectory -ItemType Directory -Force -Confirm:$false | Out-Null
@andrewconnell
andrewconnell / app.module.ts
Created March 8, 2015 16:42
ADAL JS + Angular: Loading the ADAL module
var app = angular.module('adalO365CorsClient', [
'ngRoute',
'ngAnimate',
'AdalAngular' // <<<< loading the ADAL JS Angular module
]);
@andrewconnell
andrewconnell / app.adal.ts
Created March 8, 2015 16:46
ADAL JS + Angular: Initializing the ADAL provider
module adalO365CorsClient {
'use strict';
export class Adal {
/**
* Configures ADAL JS with required info for the registered app in Azure AD.
*
* @param $httpProvider Angular's $httpProvider (needed by ADAL)
* @param adalSettings Settings for ADAL
* @param adalProvider ADAL JS' Angular provider.
@andrewconnell
andrewconnell / app.routes.ts
Created March 8, 2015 16:47
ADAL JS + Angular: Loading the Routes
module adalO365CorsClient {
'use strict';
export class Routes {
/**
* Configures the routes for the application.
* @param $routeProvider
*/
static configure($routeProvider:ng.route.IRouteProvider):void {
var baseUrl = 'app/';
@andrewconnell
andrewconnell / sharepoint.service.ts
Created March 8, 2015 16:49
ADAL JS + Angular: SharePoint Service
/**
* Get all all lists in the target SharePoint site.
*
* @param sharePointSiteApiUrl {string} URL of the REST API endpoint of the SharePoint site.
* @returns {IPromise<adalO365CorsClient.shared.ISpList[]>} Collection of all the lists in the specified SharePoint
* site.
*/
public getAllLists(sharePointSiteApiUrl:string) {
var deferred = this.$q.defer();
@andrewconnell
andrewconnell / launch.json
Created August 20, 2015 21:13
VSCode launch.json configuration to debug Yeoman generators
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch yo",
"type": "node",
// NOTE: this should be the result of running `which yo` on your system...
// for the typical NPM install & config, this is usually /usr/local/bin/yo
// however others (as below) may have global NPM packages setup in a
// different path as common to avoid using sudo on OS X
@andrewconnell
andrewconnell / gulpfile.js
Created August 21, 2015 09:42
Gulp task to run all tests in the project using Mocha
'use strict';
var gulp = require('gulp');
var mocha = require('gulp-mocha');
/**
* Execute all tests.
*/
gulp.task('run-tests', function () {
return gulp.src('test/**/*.js', { read: false })
@andrewconnell
andrewconnell / tasks.json
Created August 21, 2015 09:49
VSCode Task Configuration to Run Gulp Test Task
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "run-tests",
"isTestCommand": true,
"isBuildCommand": false