question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom ConfigureMemberCookieOptions doesn't work anymore

See original GitHub issue

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

11.4.0

Bug summary

This is while using the following attribute: [UmbracoMemberAuthorize]

When on version 11.2.2, I added a ConfigureCustomMemberCookieOptions class which redirects the Umbraco Member to the login page, when the Member wasn’t authorized to view a specific page. This class is registered in a Composer.

After I upgraded my local application to version 11.4.0, that same class didn’t work anymore, and instead of a redirect to the login page, I get a page that just shows the following: HTTP ERROR 401.

I didn’t change anything to the implementation, and I still have a working version of this running on a staging environment, where the Member is redirected to the login environment.

I looked at the changes, and maybe it might have something to do with the following bug fix? https://github.com/umbraco/Umbraco-CMS/pull/14036/files/339c9c89cb8f9f17e257719632f460cdbf8fdeda

Specifics

A simplified version of my custom ConfigureMemberCookieOptions implementation

Custom ConfigureMemberCookieOptions Implementation

Registering in the Composer builder.Services.ConfigureOptions<ConfigureCustomMemberCookieOptions>();

Steps to reproduce

Add a class which implements IConfigureNamedOptions<CookieAuthenticationOptions> and configure this in startup/composer (see Specifics).

In Umbraco 11.2.2, this will make sure that the Member is redirected to a specific page, if the Member isn’t authorized.

In Umbraco 11.4.0 this will render a basic 401 error page with the message: This page isn’t working If the problem continues, contact the site owner. HTTP ERROR 401

Expected result / actual result

No response


This item has been added to our backlog AB#30478

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Zeegaancommented, Jun 20, 2023

Thanks for the sample code, I can definitely reproduce this!

0reactions
elit0451commented, Jul 4, 2023

Fixed in: #14399

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browser is not setting cookies after Response. ...
try this: var cookieOptions = new CookieOptions { HttpOnly = true, Expires = newRefreshToken.Expires, IsEssential = true };. Response.
Read more >
Using Auth Cookies in ASP.NET Core - Simple Talk
You configure cookie options, invoke middleware, and set identity claims. Sign in and sign out methods work based on an authentication scheme.
Read more >
Authentication cookie lifetime and sliding expiration in ASP ...
This article contains an overview regarding authentication cookies lifetime and shows the way of setting its absolute value in ASP.NET Core.
Read more >
Set-Cookie - HTTP - MDN Web Docs
Means that the cookie is not sent on cross-site requests, such as on requests to load images or frames, but is sent when...
Read more >
Unable to customize cookie settings on stackoverflow.co
This appears to have been fixed. I don't know if it was fixed by fixing other problems but the Cookie Settings modal now...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found