/// <summary> /// Initializes a new instance of the <see cref="AnonymousRequestEventArgs"/> class. /// </summary> /// <param name="request">The incoming OpenID request.</param> internal AnonymousRequestEventArgs(IAnonymousRequest request) { Contract.Requires(request != null); ErrorUtilities.VerifyArgumentNotNull(request, "request"); this.Request = request; }
/// <summary> /// Fires the <see cref="AnonymousRequest"/> event. /// </summary> /// <param name="request">The request to include in the event args.</param> /// <returns><c>true</c> if there were any anonymous request handlers.</returns> protected virtual bool OnAnonymousRequest(IAnonymousRequest request) { var anonymousRequest = this.AnonymousRequest; if (anonymousRequest != null) { anonymousRequest(this, new AnonymousRequestEventArgs(request)); return(true); } else { return(false); } }
internal static void ProcessAnonymousRequest(IAnonymousRequest request) { if (request.Immediate) { // NOTE: in a production provider site, you may want to only // respond affirmatively if the user has already authorized this consumer // to know the answer. request.IsApproved = HttpContext.Current.User.Identity.IsAuthenticated; if (request.IsApproved.Value) { // Add extension responses here. // These would typically be filled in from a user database } } else { HttpContext.Current.Response.Redirect("~/decide.aspx", false); } }
/// <summary> /// Initializes a new instance of the <see cref="AnonymousRequestEventArgs"/> class. /// </summary> /// <param name="request">The incoming OpenID request.</param> internal AnonymousRequestEventArgs(IAnonymousRequest request) { Requires.NotNull(request, "request"); this.Request = request; }
/// <summary> /// Fires the <see cref="AnonymousRequest"/> event. /// </summary> /// <param name="request">The request to include in the event args.</param> /// <returns><c>true</c> if there were any anonymous request handlers.</returns> protected virtual bool OnAnonymousRequest(IAnonymousRequest request) { var anonymousRequest = this.AnonymousRequest; if (anonymousRequest != null) { anonymousRequest(this, new AnonymousRequestEventArgs(request)); return true; } else { return false; } }
/// <summary> /// Initializes a new instance of the <see cref="AnonymousRequestEventArgs"/> class. /// </summary> /// <param name="request">The incoming OpenID request.</param> internal AnonymousRequestEventArgs(IAnonymousRequest request) { Contract.Requires <ArgumentNullException>(request != null); this.Request = request; }
private static bool IsAuthApproved(IAuthenticationRequest authReq, IAnonymousRequest anonReq) { return((authReq != null && (authReq.IsAuthenticated ?? false)) || (anonReq != null && (anonReq.IsApproved ?? false))); }