private void HandleRequestAuthenticationCompleted(object userState) { if (!AuthorizationNavigationManager.IsAuthorized(this.GetCurrentUri(), this._frame.Content)) { // If the user is still not authorized, he needs to be redirected this.Redirect(); } }
private void AuthorizeFrameContent() { if (!AuthorizationNavigationManager.IsAuthorized(this.GetCurrentUri(), this._frame.Content)) { AuthorizationNavigationMode navigationMode = this.GetContentNavigationMode(this._frame.Content); if (WebContextBase.Current.Authentication.User.Identity.IsAuthenticated || (navigationMode == AuthorizationNavigationMode.Redirect)) { // If the user is authenticated but not authorized, he needs to be redirected this.Redirect(); } else if (navigationMode == AuthorizationNavigationMode.Prompt) { if (Authorization.Prompter == null) { throw new InvalidOperationException("Authorization.Prompter cannot be null when the navigationMode is 'Prompt'."); } // If the user is not authenticated, we need to prompt for re-authentication or redirect Authorization.Prompter.RequestAuthentication(this.HandleRequestAuthenticationCompleted, null); } } }