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
#region private methods | |
private void RememberCodeVerifier(RedirectToIdentityProviderNotification<OpenIdConnectMessage, OpenIdConnectAuthenticationOptions> n, string codeVerifier) | |
{ | |
var properties = new AuthenticationProperties(); | |
properties.Dictionary.Add("cv", codeVerifier); | |
//if left blank or set to 0, the setting is not used. OOTB default is 15min | |
if(ConfigurationManager.AppSettings[AzureB2CConstants.Keys.NonceLifetime] != null && | |
double.TryParse("30", out double lifetime) && lifetime > 0) | |
{ |
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
//----1----- | |
function SomeComponent() | |
{ | |
return <d><H1>Hellow World</H1><>; | |
} | |
export default SomeComponent; | |
//Concise Way | |
export default SomeComponent() | |
{ |
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
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> | |
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head runat="server"> | |
<title></title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> | |
<script> | |
$(function () { |
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
/* | |
Reference | |
https://blog.baslijten.com/federated-authentication-in-sitecore-error-unsuccessful-login-with-external-provider/ | |
*/ | |
public void SignIn(string returnUrl) | |
{ | |
// The param returnUrl is configured in Azure B2C Identity Provider. | |
// The redirect URL is to redirect to externallogincallback method of Sitecore Owin and then load returnUrl Sign-in | |
var properties = new AuthenticationProperties() { RedirectUri = "https://abc/identity/externallogincallback?ReturnUrl=/sign-in" }; | |
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
<div> | |
<h2> | |
Orign Location | |
</h2> | |
</div> | |
<div id="locationField"> | |
<input id="originautocomplete" placeholder="Enter your address" onFocus="geolocate()" type="text"></input> | |
</div> | |
<div> |
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
//Azure AD B2C Owin Context is null , once the token is acquired by authorization code flow | |
//Set Authentication Manager profile | |
var authenticated = HttpContext.GetOwinContext().Authentication.AuthenticateAsync("ExternalCookie"); | |
// Send Access Token bearer to api to get logged user details | |
var loggedInUser = AuthenticationManager.BuildVirtualUser(string.Format(@"{0}\{1}", "external", "User-ID"), true); | |
loggedInUser.RuntimeSettings.AddedRoles.Add(authenticated.Result.Identity.Claims.First().Value); | |
loggedInUser.Profile.FullName = string.Format("{0} {1}", authenticated.Result.Identity.Name, authenticated.Result.Identity.Claims.Last().Value); | |
loggedInUser.Profile.Save(); |
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
Assembly asm = Assembly.GetAssembly(typeof(MyWebDll.MvcApplication)); | |
var controlleractionlist = asm.GetTypes() | |
.Where(type=> typeof(System.Web.Mvc.Controller).IsAssignableFrom(type)) | |
.SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public)) | |
.Where(m => !m.GetCustomAttributes(typeof( System.Runtime.CompilerServices.CompilerGeneratedAttribute), true).Any()) | |
.Select(x => new {Controller = x.DeclaringType.Name, Action = x.Name, ReturnType = x.ReturnType.Name, Attributes = String.Join(",", x.GetCustomAttributes().Select(a => a.GetType().Name.Replace("Attribute",""))) }) | |
.OrderBy(x=>x.Controller).ThenBy(x => x.Action).ToList(); |
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 class SessionService : ISessionService | |
{ | |
private readonly ICryptoService _cryptoService; | |
private readonly string _encryptionKey = ConfigurationManager.AppSettings[AppSettingKeys.Common.SessionEncryptionKey]; | |
public SessionService(ICryptoService cryptoService) | |
{ | |
_cryptoService = cryptoService; | |
} |
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; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
I1 ia = new C(); | |
ia.Method1(); |
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 Sitecore; | |
using Sitecore.Pipelines.HttpRequest; | |
using System.Web.Security; | |
namespace MyProject.Customm.Pipelines.HttpRequest | |
{ | |
/// <summary> | |
/// The pipeline processor intercept site setting EnabledMaintenance flag before request get processed. | |
/// </summary> | |
NewerOlder