public virtual string GetAuthQueryUrl(OpenIdAuthMode mode, string antiForgeryToken) { return AuthUri .Replace("{ClientId}", ClientId) .Replace("{Scope}", Scope) .Replace("{RedirectUri}", RedirectUri) .Replace("{State}", String.Format("{0}|{1}|{2}", Type, mode, antiForgeryToken)); }
public PartialViewResult OpenIdMenu(OpenIdAuthMode mode = OpenIdAuthMode.LogOn, bool isVertical = false) { string antiForgeryToken = Guid.NewGuid().ToString("N"); Session[AntiForgeryKey] = antiForgeryToken; var model = new OpenIdMenu(_openIdConfigService.GetConfig(), mode, antiForgeryToken, isVertical); return PartialView("_OpenIdMenu", model); }
public OpenIdMenu(IEnumerable<OpenIdConfig> config, OpenIdAuthMode mode, string antiForgeryToken, bool isVertical = false) { Items = config.Select(x => new OpenIdMenuItem { TypeName = x.Type.GetDescription(), AuthUrl = x.GetAuthQueryUrl(mode, antiForgeryToken), IconCssClass = x.IconCssClass }); Mode = mode; IsVertical = isVertical; }
public override string GetAuthQueryUrl(OpenIdAuthMode mode, string antiForgeryToken) { string state = String.Format("{0}|{1}|{2}", Type, mode, antiForgeryToken); string timestamp = CreateTimestamp(); string clientSecret = CreateClientSecret(state, timestamp); return AuthUri .Replace("{ClientId}", ClientId) .Replace("{Scope}", Scope) .Replace("{RedirectUri}", RedirectUri) .Replace("{State}", state) .Replace("{ClientSecret}", clientSecret) .Replace("{Timestamp}", timestamp); }
public virtual string GetAuthQuery(OpenIdAuthMode mode, string antiForgeryToken) { return GetAuthQueryUrl(mode, antiForgeryToken).Split('?').Last(); }