How to get the referer for unathenticated URL in spring security












0














In spring security Config file we have handled the unauthenticated urls must go through login page.
.loginPage("/login/forward")



when it goes to this particular handler Controller, I wanna know for which unauthenticated URLS it has come to this controller.



For example if I am trying to access http://localhost/ab/getAbc and if it is not an authenticated URL , so spring security will redirect to .loginPageMethod for all unauthorized URL. Now when it is going to /login/forward I am unable to get the Url page which user tried to access at first time.










share|improve this question






















  • Why do you want to know the URL?
    – dur
    Dec 28 '18 at 9:15










  • I have two different environment there so lets first one is /ab/getAbc and the second one is /bc/getBcd, Now for first one I wanna redirect to error page and for the second one I wanna put a push message. I am able to the variable using getSession().setAttributes but I dont wanna use the session object, how to achieve this?
    – Ashwini Jha
    Jan 3 at 7:08










  • You could inject the request and get the URL from the request.
    – dur
    Jan 3 at 10:54
















0














In spring security Config file we have handled the unauthenticated urls must go through login page.
.loginPage("/login/forward")



when it goes to this particular handler Controller, I wanna know for which unauthenticated URLS it has come to this controller.



For example if I am trying to access http://localhost/ab/getAbc and if it is not an authenticated URL , so spring security will redirect to .loginPageMethod for all unauthorized URL. Now when it is going to /login/forward I am unable to get the Url page which user tried to access at first time.










share|improve this question






















  • Why do you want to know the URL?
    – dur
    Dec 28 '18 at 9:15










  • I have two different environment there so lets first one is /ab/getAbc and the second one is /bc/getBcd, Now for first one I wanna redirect to error page and for the second one I wanna put a push message. I am able to the variable using getSession().setAttributes but I dont wanna use the session object, how to achieve this?
    – Ashwini Jha
    Jan 3 at 7:08










  • You could inject the request and get the URL from the request.
    – dur
    Jan 3 at 10:54














0












0








0







In spring security Config file we have handled the unauthenticated urls must go through login page.
.loginPage("/login/forward")



when it goes to this particular handler Controller, I wanna know for which unauthenticated URLS it has come to this controller.



For example if I am trying to access http://localhost/ab/getAbc and if it is not an authenticated URL , so spring security will redirect to .loginPageMethod for all unauthorized URL. Now when it is going to /login/forward I am unable to get the Url page which user tried to access at first time.










share|improve this question













In spring security Config file we have handled the unauthenticated urls must go through login page.
.loginPage("/login/forward")



when it goes to this particular handler Controller, I wanna know for which unauthenticated URLS it has come to this controller.



For example if I am trying to access http://localhost/ab/getAbc and if it is not an authenticated URL , so spring security will redirect to .loginPageMethod for all unauthorized URL. Now when it is going to /login/forward I am unable to get the Url page which user tried to access at first time.







spring-boot spring-security






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 28 '18 at 5:58









Ashwini JhaAshwini Jha

25




25












  • Why do you want to know the URL?
    – dur
    Dec 28 '18 at 9:15










  • I have two different environment there so lets first one is /ab/getAbc and the second one is /bc/getBcd, Now for first one I wanna redirect to error page and for the second one I wanna put a push message. I am able to the variable using getSession().setAttributes but I dont wanna use the session object, how to achieve this?
    – Ashwini Jha
    Jan 3 at 7:08










  • You could inject the request and get the URL from the request.
    – dur
    Jan 3 at 10:54


















  • Why do you want to know the URL?
    – dur
    Dec 28 '18 at 9:15










  • I have two different environment there so lets first one is /ab/getAbc and the second one is /bc/getBcd, Now for first one I wanna redirect to error page and for the second one I wanna put a push message. I am able to the variable using getSession().setAttributes but I dont wanna use the session object, how to achieve this?
    – Ashwini Jha
    Jan 3 at 7:08










  • You could inject the request and get the URL from the request.
    – dur
    Jan 3 at 10:54
















Why do you want to know the URL?
– dur
Dec 28 '18 at 9:15




Why do you want to know the URL?
– dur
Dec 28 '18 at 9:15












I have two different environment there so lets first one is /ab/getAbc and the second one is /bc/getBcd, Now for first one I wanna redirect to error page and for the second one I wanna put a push message. I am able to the variable using getSession().setAttributes but I dont wanna use the session object, how to achieve this?
– Ashwini Jha
Jan 3 at 7:08




I have two different environment there so lets first one is /ab/getAbc and the second one is /bc/getBcd, Now for first one I wanna redirect to error page and for the second one I wanna put a push message. I am able to the variable using getSession().setAttributes but I dont wanna use the session object, how to achieve this?
– Ashwini Jha
Jan 3 at 7:08












You could inject the request and get the URL from the request.
– dur
Jan 3 at 10:54




You could inject the request and get the URL from the request.
– dur
Jan 3 at 10:54












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53954270%2fhow-to-get-the-referer-for-unathenticated-url-in-spring-security%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53954270%2fhow-to-get-the-referer-for-unathenticated-url-in-spring-security%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Angular Downloading a file using contenturl with Basic Authentication

Olmecas

Can't read property showImagePicker of undefined in react native iOS