Exemplo n.º 1
0
 public MoneyKeyController(IMapper mapper, AccountService accountService, AuthenticationSupport authenticationSupport, MoneyKeyService moneyKeyService)
 {
     _mapper                = mapper;
     _accountService        = accountService;
     _authenticationSupport = authenticationSupport;
     _moneyKeyService       = moneyKeyService;
 }
Exemplo n.º 2
0
 public OrderService(ShopContext context,
                     InvitationService invitationService,
                     AuthenticationSupport authenticationSupport)
 {
     _context               = context;
     _invitationService     = invitationService;
     _authenticationSupport = authenticationSupport;
 }
Exemplo n.º 3
0
 public AccountController(IMapper mapper,
                          AccountService accountService,
                          AuthenticationSupport authenticationSupport,
                          InvitationService invitationService)
 {
     _mapper                = mapper;
     _accountService        = accountService;
     _authenticationSupport = authenticationSupport;
     _invitationService     = invitationService;
 }
Exemplo n.º 4
0
 public ProductController(IMapper mapper,
                          AccountService accountService,
                          ProductService productService,
                          AuthenticationSupport authenticationSupport,
                          OrderService orderService,
                          InvitationService invitationService)
 {
     _mapper                = mapper;
     _accountService        = accountService;
     _productService        = productService;
     _authenticationSupport = authenticationSupport;
     _orderService          = orderService;
     _invitationService     = invitationService;
 }
Exemplo n.º 5
0
 protected void Application_AuthenticateRequest(object sender, EventArgs e)
 {
     AuthenticationSupport.SetUserFromCookieIfExists(HttpContext.Current);
 }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["SignOut"] != null)
            {
                AuthenticationSupport.ClearAuthenticationCookie(Response);
                Response.Redirect("/", true);
                return;
            }
            openIdBox.Focus();
            OpenIdRelyingParty openid = new OpenIdRelyingParty();
            var            response   = openid.GetResponse();
            ClaimsResponse profileFields;
            string         friendlyName;
            string         idprovider    = Request.Params["idprovider"];
            string         idProviderUrl = Request.Params["idProviderUrl"];

            if (response != null)
            {
                switch (response.Status)
                {
                case AuthenticationStatus.Authenticated:
                    // This is where you would look for any OpenID extension responses included
                    // in the authentication assertion.
                    var claimsResponse = response.GetExtension <ClaimsResponse>();
                    profileFields = claimsResponse;
                    // Store off the "friendly" username to display -- NOT for username lookup
                    friendlyName = response.FriendlyIdentifierForDisplay;
                    // Use FormsAuthentication to tell ASP.NET that the user is now logged in,
                    // with the OpenID Claimed Identifier as their username.
                    string userName = response.ClaimedIdentifier.ToString();
                    //FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, userName,
                    //                                                                 DateTime.Now,
                    //                                                                 DateTime.Now.AddDays(10),
                    //                                                                 true, "user custom data");

                    AuthenticationSupport.SetAuthenticationCookie(Response, userName);
                    //FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, false);
                    //string redirectUrl = FormsAuthentication.GetRedirectUrl(userName, true);
                    string redirectUrl = Request.Params["ReturnUrl"];
                    if (redirectUrl == null)
                    {
                        redirectUrl = FormsAuthentication.DefaultUrl;
                    }
                    Response.Redirect(redirectUrl, true);
                    break;

                case AuthenticationStatus.Canceled:
                    this.loginCanceledLabel.Visible = true;
                    break;

                case AuthenticationStatus.Failed:
                    this.loginFailedLabel.Visible = true;
                    break;
                }
            }
            else
            {
                if (String.IsNullOrEmpty(idProviderUrl) == false)
                {
                    CreateOpenIDRequestAndRedirect(idProviderUrl);
                    return;
                }
                if (idprovider != null)
                {
                    switch (idprovider)
                    {
                    case "google":
                        PerformGoogleLogin();
                        return;

                    case "yahoo":
                        PerformYahooLogin();
                        return;

                    case "aol":
                        PerformAOLLogin();
                        return;

                    case "wordpress":
                        openIdBox.Text = "http://ENTER-YOUR-BLOG-NAME-HERE.wordpress.com";
                        break;

                    default:
                        break;
                    }
                }
            }
        }