Exemplo n.º 1
0
        public static string SignInUrl(this HtmlHelper html, string siteMarkerName = "Login")
        {
            var returnUrlKey = FederationCrmConfigurationManager.GetUserRegistrationSettings().ReturnUrlKey ?? "returnurl";
            var returnUrl    = html.ViewContext.RequestContext.HttpContext.Request[returnUrlKey] ?? html.ViewContext.RequestContext.HttpContext.Request.Url.PathAndQuery;
            var url          = html.SiteMarkerUrl(siteMarkerName, new NameValueCollection {
                { returnUrlKey, returnUrl }
            });

            return(url);
        }
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var registrationSettings = FederationCrmConfigurationManager.GetUserRegistrationSettings();

            if (!registrationSettings.Enabled)
            {
                filterContext.Result = new HttpNotFoundResult();

                return;
            }

            base.OnActionExecuting(filterContext);
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var settings          = FederationCrmConfigurationManager.GetUserRegistrationSettings();
            var invitationCodeKey = settings.InvitationCodeKey ?? "invitation";
            var returnUrlKey      = settings.ReturnUrlKey ?? "returnurl";
            var liveIdTokenKey    = settings.LiveIdTokenKey ?? "live-id-token";

            var context = new Dictionary <string, string>
            {
                { returnUrlKey, Request[returnUrlKey] },
            };

            if (!string.IsNullOrWhiteSpace(Request[invitationCodeKey]))
            {
                context.Add(invitationCodeKey, Request[invitationCodeKey]);
            }

            if (!string.IsNullOrWhiteSpace(Request[liveIdTokenKey]))
            {
                context.Add(liveIdTokenKey, Request[liveIdTokenKey]);
            }

            var fam = new CrmFederationAuthenticationModule(Context);

            var manager = ScriptManager.GetCurrent(Page);

            if (manager == null)
            {
                return;
            }

            var script = new ScriptReference("~/js/acs.js");

            manager.Scripts.Add(script);

            var reference = new ScriptReference(fam.GetHomeRealmDiscoveryMetadataFeedUrl(callback: "HandleSigninPage", context: context));

            manager.Scripts.Add(reference);
        }
Exemplo n.º 4
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            MissingFieldsMessage.Visible = false;

            var contact = XrmContext.MergeClone(Contact);

            ManageLists(XrmContext, contact);

            ProfileFormView.UpdateItem();

            var returnUrlKey = FederationCrmConfigurationManager.GetUserRegistrationSettings().ReturnUrlKey ?? "returnurl";
            var returnUrl    = Request[returnUrlKey];

            if (!string.IsNullOrWhiteSpace(returnUrl))
            {
                Context.RedirectAndEndResponse(returnUrl);
            }
        }
Exemplo n.º 5
0
 public LiveIdAccountTransferHandler()
     : this(FederationCrmConfigurationManager.GetUserRegistrationSettings())
 {
 }