Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 public virtual string GetAuthQuery(OpenIdAuthMode mode, string antiForgeryToken)
 {
     return GetAuthQueryUrl(mode, antiForgeryToken).Split('?').Last();
 }