Ejemplo n.º 1
0
 /// <summary>
 /// Handles the Load event of the Page control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     this.loginHelper = new WebLoginHelper(this);
     if (loginHelper.IsLoggedIn)
     {
         client.Config.OAuth2RefreshToken = loginHelper.Credentials.Token.RefreshToken;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Called before the action method is invoked.
 /// </summary>
 /// <param name="context">The action executing context.</param>
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     this.loginHelper = new WebLoginHelper(this.HttpContext, client.Config);
     if (loginHelper.IsLoggedIn)
     {
         client.Config.OAuth2RefreshToken = loginHelper.TokenResponse.RefreshToken;
     }
     base.OnActionExecuting(context);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the GET call.
        /// </summary>
        public IActionResult OnGet()
        {
            loginHelper = new WebLoginHelper(this.HttpContext, config);
            if (loginHelper.IsLoggedIn)
            {
                // Redirect to the main page.
                return(Redirect("/Index"));
            }
            else if (loginHelper.IsCallbackFromOAuthServer())
            {
                loginHelper.ExchangeAuthorizationCodeForCredentials();

                // Redirect to the main page.
                return(Redirect("/Index"));
            }
            else
            {
                // Redirect the user to the OAuth2 login page.
                return(loginHelper.RedirectUsertoOAuthServer());
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Handles the GET call.
 /// </summary>
 /// <returns></returns>
 public IActionResult OnGet()
 {
     this.loginHelper = new WebLoginHelper(this.HttpContext, config);
     return(Page());
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Login"/> class.
 /// </summary>
 public Login()
 {
     loginHelper = new WebLoginHelper(this);
 }