View cert_json_body.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the below script in PowerShell Core | |
# to output json body for uploading SSL Cert to Enterprise Application | |
$pfxpath = "C:\Users\<path to pfx>\testpfx.pfx" | |
$cerpath = "C:\Users\<path to cer>\testcer.cer" | |
$password = "<pfx password>" | |
$Secure_String_Pwd = ConvertTo-SecureString $password -AsPlainText -Force | |
$pfx_cert = get-content $pfxpath -AsByteStream -Raw |
View OAuth2PermissionGrant.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# script to manage User Consent (Delegated permission). The following script does | |
# - Remove all MS Graph Delegated permissions (if any) for the user | |
# - Perform user consent for an initial set of MS Graph permission | |
# - Update the consented permission list with some additional permissions | |
# - Remove some permissions from the consented permission list | |
# - Remove (revoke) all consented permissions for the user | |
# Continue to output logs - SilentlyContinue to keep going | |
$GLOBAL:DebugPreference="SilentlyContinue" | |
View WSTrustBody.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST https://www.contoso.com/adfs/services/trust/2005/usernamemixed | |
HTTP Headers: | |
SOAPAction: http://schemas.xmlsoap.org/ws/2005/trust/RST/issue | |
Content-Type: application/soap+xml | |
client-request-id: 6ca4424a-8d29-4b62-b7cb-5e44ce038af5 | |
return-client-request-id: true | |
Accept: application/json | |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Azure.Management.Graph.RBAC.Fluent; | |
using Microsoft.Azure.Management.ResourceManager.Fluent; | |
using System; | |
namespace AzureSDKNetConsoleApp | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
View Startup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Authentication.JwtBearer; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; |
View Startup.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using Microsoft.AspNetCore.Authentication.JwtBearer; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace CoreWebAPIAAD | |
{ |
View MSALNetB2C.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using Microsoft.Identity.Client; | |
using System.Net.Http; | |
using System.Net; | |
namespace msalb2c | |
{ | |
class Program |
View Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.Identity.Client; | |
using System.Net.Http; | |
namespace MSALConsoleApp | |
{ |
View OfficeDetection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Workaround below to detect Office request comes from the user smichtch in | |
https://github.com/aspnet/AspNetKatana/issues/78 | |
*/ | |
using System; | |
using System.Collections.Generic; | |
using System.Configuration; | |
using System.Globalization; | |
using System.Linq; |
View Startup.Auth.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureAuth(IAppBuilder app) | |
{ | |
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); | |
app.UseCookieAuthentication(new CookieAuthenticationOptions()); | |
app.UseOpenIdConnectAuthentication( | |
new OpenIdConnectAuthenticationOptions | |
{ | |
ClientId = clientId, | |
Authority = authority, | |
PostLogoutRedirectUri = postLogoutRedirectUri, |
NewerOlder