Skip to content

Instantly share code, notes, and snippets.

View georgechang's full-sized avatar
☁️
coming out of cloud retirement

George Chang georgechang

☁️
coming out of cloud retirement
View GitHub Profile
@georgechang
georgechang / Enable-ItemLanguageFallback.ps1
Created September 2, 2017 00:05
Sets the Enable Item Fallback property on standard values to be enabled.
Get-ChildItem -Path master:/sitecore/templates/something -Recurse | ? { $_.Name -eq "__Standard Values" } | % { $_.'__Enable item fallback' = 1 }
@georgechang
georgechang / SPEAddLang.ps1
Last active September 19, 2017 21:49
SPE - Create new language versions of items and copy the contents from the source language
Get-ChildItem "/sitecore/content/home" -Recurse | % { Add-ItemLanguage $_ -Language "en" -TargetLanguage "en-GB" -IfExist Over }
@georgechang
georgechang / generate-ssl-solr.bat
Created October 25, 2017 00:24
Generate Solr SSL key
keytool -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass secret -storepass secret -validity 9999 -keystore solr-ssl.keystore.jks -ext SAN=DNS:localhost,IP:127.0.0.1 -dname "CN=localhost, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country"
keytool -importkeystore -srckeystore solr-ssl.keystore.jks -destkeystore solr-ssl.keystore.p12 -srcstoretype jks -deststoretype pkcs12
@georgechang
georgechang / Get-WindowsFeaturesList.ps1
Created November 20, 2017 16:45
Get a list of installed Windows Features
Import-module servermanager ; Get-WindowsFeature | where-object {$_.Installed -eq $True} | format-list DisplayName
@georgechang
georgechang / Get-SitecoreInstallation.psm1
Last active December 24, 2017 10:15
When you're building out a new server and you don't want to deal with all the default IE restrictions just to download Sitecore installation files.
function Get-SitecoreInstallation {
param(
[string]$Url,
[string]$UserName,
[string]$Password,
[string]$FilePath
)
$loginRequest = Invoke-RestMethod -Uri https://dev.sitecore.net/api/authorization -Method Post -ContentType "application/json" -Body "{username: '$UserName', password: '$Password'}" -SessionVariable session -UseBasicParsing
Invoke-WebRequest -Uri $url -WebSession $session -OutFile $FilePath -UseBasicParsing
}
"InstallWDP": {
"Type": "WebDeploy",
"Params": {
"Verb": "Sync",
"Arguments": {
"Source": {
"Package": "[resolvepath(parameter('Package'))]"
},
"Dest": "Auto",
"Skip": [
@georgechang
georgechang / FacebookIdentityProvider.config
Last active September 9, 2018 23:49
Configuration for Facebook authentication in Sitecore 9
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<federatedAuthentication>
<identityProviders>
<identityProvider id="Facebook" type="Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication">
<param desc="name">$(id)</param>
<param desc="domainManager" type="Sitecore.Abstractions.BaseDomainManager" resolve="true" />
<caption>Login with Facebook</caption>
<icon>/sitecore/shell/themes/standard/Images/24x24/facebook.png</icon>
@georgechang
georgechang / Sitecore.Owin.Authentication.Enabler.config
Created January 23, 2018 01:25
Default Sitecore Authentication Enabler Config
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore role:require="Standalone or ContentManagement">
<settings>
<setting name="FederatedAuthentication.Enabled">
<patch:attribute name="value">true</patch:attribute>
</setting>
</settings>
<services>
<register serviceType="Sitecore.Abstractions.BaseAuthenticationManager, Sitecore.Kernel" implementationType="Sitecore.Owin.Authentication.Security.AuthenticationManager, Sitecore.Owin.Authentication" lifetime="Singleton" />
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<federatedAuthentication>
<identityProviders>
<identityProvider id="saml2" type="Sitecore.Owin.Authentication.Configuration.DefaultIdentityProvider, Sitecore.Owin.Authentication">
<param desc="name">$(id)</param>
<param desc="domainManager" type="Sitecore.Abstractions.BaseDomainManager" resolve="true" />
<caption>Login with Azure Active Directory (SAML2p)</caption>
<domain>sitecore</domain>
using System;
using System.IdentityModel.Metadata;
using System.Security.Claims;
using Owin;
using Sitecore.Configuration;
using Sitecore.Owin.Authentication.Configuration;
using Sitecore.Owin.Authentication.Extensions;
using Sitecore.Owin.Authentication.Pipelines.IdentityProviders;
using Sitecore.Owin.Authentication.Services;
using Sustainsys.Saml2.Configuration;