Customize permission denied page
roneigebert opened this issue · 2 comments
roneigebert commented
In my permission denied page, I need to get the previous page URL, because through Javascript it is not possible.
I thing the easyer way (maybe not the best) to do this is changing the method AuthenticationRunner#redirectToPermissionDeniedPage, from:
void redirectToPermissionDeniedPage() {
exchange.setStatusCode( 303 );
exchange.getResponseHeaders().put( Headers.LOCATION, permissionDeniedPage );
}
To:
void redirectToPermissionDeniedPage(HttpServerExchange exchange) {
val currentPageUrl = currentEscapedPage(exchange);
exchange.setStatusCode( 303 );
val permissionDeniedPage = permissionDeniedPage.replace("{current-page}", currentPageUrl);
exchange.getResponseHeaders().put( Headers.LOCATION, permissionDeniedPage );
}
and than I can use in my conf file:
server:
auth:
endpoints:
permission-denied-page: "/forbidden?previousPage={current-page}"
roneigebert commented
@miere, can you help me with this?
miere commented
Sure,
I'd be happy to help you, although I'd only have free time on Friday night
here.
I have some personal issues to solve until there.
If you're in a rush and you send me a PR I'd be happy to review and apply
it for you! ;)
Cheers!
…On Sat, Mar 9, 2019 at 9:03 AM Ronei ***@***.***> wrote:
@miere <https://github.com/miere>, can you help me with this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#256 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAf20H-45To1QIv8gIB0TgyMH2KMRxOyks5vUt4ogaJpZM4bmL5K>
.
--
/* Miere L. Teixeira */