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.AspNetCore.Authentication; | |
using Microsoft.AspNetCore.Authentication.OpenIdConnect; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Logging; | |
using Sitecore.Framework.Runtime.Configuration; | |
using Sitecore.Plugin.IdentityProvider.Ids4Demo.Configuration; | |
using System; | |
using System.Security.Claims; | |
using System.Threading.Tasks; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Settings> | |
<Sitecore> | |
<ExternalIdentityProviders> | |
<IdentityProviders> | |
<Ids4Demo type="Sitecore.Plugin.IdentityProviders.IdentityProvider, Sitecore.Plugin.IdentityProviders"> | |
<AuthenticationScheme>IdS4-Ids4Demo</AuthenticationScheme> | |
<DisplayName>IdentityServer Demo Identity Provider</DisplayName> | |
<Enabled>true</Enabled> | |
<ClientId>implicit</ClientId> |
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.Net.Http; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Authorization; | |
using Microsoft.AspNetCore.Mvc; | |
using Newtonsoft.Json; | |
namespace SitecoreApi | |
{ | |
[Route("sitecorelayout")] | |
[Authorize] |
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 Clients; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.AspNetCore.Authentication.JwtBearer; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Logging; | |
namespace SitecoreApi | |
{ | |
public class Startup |
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
[Authorize] | |
public async Task<IActionResult> CallSitecoreApi() | |
{ | |
var token = await HttpContext.GetTokenAsync("access_token"); | |
var client = _httpClientFactory.CreateClient(); | |
client.SetBearerToken(token); | |
var response = await client.GetStringAsync(Constants.SitecoreApi + "sitecorelayout"); | |
var obj = JsonConvert.DeserializeObject(response); | |
ViewBag.Json = JsonConvert.SerializeObject(obj, Formatting.Indented); | |
return View(); |
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
[Authorize] | |
public IActionResult Secure() | |
{ | |
ViewData["Message"] = "Secure page."; | |
return View(); | |
} |
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.IdentityModel.Tokens.Jwt; | |
using System.Net.Http; | |
using Clients; | |
using IdentityModel; | |
using IdentityModel.Client; | |
using Microsoft.AspNetCore.Authentication; | |
using Microsoft.AspNetCore.Authentication.Cookies; | |
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; |
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
<ExternalClient> | |
<ClientId>sitecoremvc</ClientId> | |
<ClientName>sitecoremvcclient</ClientName> | |
<ClientSecrets> | |
<ClientSecret1>abracadabra</ClientSecret1> | |
</ClientSecrets> | |
<AccessTokenType>0</AccessTokenType> | |
<AllowOfflineAccess>true</AllowOfflineAccess> | |
<AlwaysIncludeUserClaimsInIdToken>false</AlwaysIncludeUserClaimsInIdToken> | |
<AccessTokenLifetimeInSeconds>3600</AccessTokenLifetimeInSeconds> |
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
############################################################################################ | |
#This script is created to remove Sitecore 9 instance from local machine. | |
#This will not uninstall Solr but, it will remove Solr collections. | |
#The script looks at the Prefix parameter and find out all instances and remove them. | |
#Change the default values before using the script. Or, pass the values as parameters. | |
#Usage: .\Remove-Sitecore9-Instance.ps1 -Prefix "xp0" | |
#Declaimer: This is a destructive script, means, it deletes files, databases etc. | |
#Use it at your own risk. |