Centralized session in multiple product having different domain
I am developing centralized admin module for multiple product. Trying to maintain same session across multiple product.

For Product1 : Authenticate successfully and send token in response header
Request URL:http://localhost:8080/admin-web/rest/authenticate/
Request Headers
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Host:localhost:8080
Origin:http://product1.com:9090
Pragma:no-cache
Referer:http://product1.com:9090/p1/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
Response Headers
Set-Cookie:token=asdf123sfs1f23sfsf321sfsf21; Version=1; Comment=""; Domain=localhost; Path=/ <------------------------------------???
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:http://product1.com:9090
Content-Encoding:gzip
Content-Type:application/json
Date:Mon, 13 Nov 2017 12:38:27 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked
Vary:Origin
Vary:Accept-Encoding
For Product2 :
Request URL:http://localhost:8080/admin-web/rest/authenticate/
Request Headers
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Content-Length:156
Content-Type:application/json;charset=UTF-8
Host:localhost:8080
Origin:http://product2.com:9090
Pragma:no-cache
Referer:http://product2.com:9090/p2/
token:null <------------------------------------???
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
While doing product2 authentication after product1 authentication, token found null. If I deploy product1 on same domain, it works fine.
So, I want to use token header for same service url in another product request. How can I do it? Please find my CORS configuration below :
<filter>
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<init-param>
<param-name>cors.allowOrigin</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, HEAD, POST, OPTIONS, PUT, DELETE</param-value>
</init-param>
</filter>
java angularjs rest cookies cors
add a comment |
I am developing centralized admin module for multiple product. Trying to maintain same session across multiple product.

For Product1 : Authenticate successfully and send token in response header
Request URL:http://localhost:8080/admin-web/rest/authenticate/
Request Headers
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Host:localhost:8080
Origin:http://product1.com:9090
Pragma:no-cache
Referer:http://product1.com:9090/p1/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
Response Headers
Set-Cookie:token=asdf123sfs1f23sfsf321sfsf21; Version=1; Comment=""; Domain=localhost; Path=/ <------------------------------------???
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:http://product1.com:9090
Content-Encoding:gzip
Content-Type:application/json
Date:Mon, 13 Nov 2017 12:38:27 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked
Vary:Origin
Vary:Accept-Encoding
For Product2 :
Request URL:http://localhost:8080/admin-web/rest/authenticate/
Request Headers
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Content-Length:156
Content-Type:application/json;charset=UTF-8
Host:localhost:8080
Origin:http://product2.com:9090
Pragma:no-cache
Referer:http://product2.com:9090/p2/
token:null <------------------------------------???
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
While doing product2 authentication after product1 authentication, token found null. If I deploy product1 on same domain, it works fine.
So, I want to use token header for same service url in another product request. How can I do it? Please find my CORS configuration below :
<filter>
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<init-param>
<param-name>cors.allowOrigin</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, HEAD, POST, OPTIONS, PUT, DELETE</param-value>
</init-param>
</filter>
java angularjs rest cookies cors
add a comment |
I am developing centralized admin module for multiple product. Trying to maintain same session across multiple product.

For Product1 : Authenticate successfully and send token in response header
Request URL:http://localhost:8080/admin-web/rest/authenticate/
Request Headers
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Host:localhost:8080
Origin:http://product1.com:9090
Pragma:no-cache
Referer:http://product1.com:9090/p1/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
Response Headers
Set-Cookie:token=asdf123sfs1f23sfsf321sfsf21; Version=1; Comment=""; Domain=localhost; Path=/ <------------------------------------???
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:http://product1.com:9090
Content-Encoding:gzip
Content-Type:application/json
Date:Mon, 13 Nov 2017 12:38:27 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked
Vary:Origin
Vary:Accept-Encoding
For Product2 :
Request URL:http://localhost:8080/admin-web/rest/authenticate/
Request Headers
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Content-Length:156
Content-Type:application/json;charset=UTF-8
Host:localhost:8080
Origin:http://product2.com:9090
Pragma:no-cache
Referer:http://product2.com:9090/p2/
token:null <------------------------------------???
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
While doing product2 authentication after product1 authentication, token found null. If I deploy product1 on same domain, it works fine.
So, I want to use token header for same service url in another product request. How can I do it? Please find my CORS configuration below :
<filter>
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<init-param>
<param-name>cors.allowOrigin</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, HEAD, POST, OPTIONS, PUT, DELETE</param-value>
</init-param>
</filter>
java angularjs rest cookies cors
I am developing centralized admin module for multiple product. Trying to maintain same session across multiple product.

For Product1 : Authenticate successfully and send token in response header
Request URL:http://localhost:8080/admin-web/rest/authenticate/
Request Headers
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Host:localhost:8080
Origin:http://product1.com:9090
Pragma:no-cache
Referer:http://product1.com:9090/p1/
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
Response Headers
Set-Cookie:token=asdf123sfs1f23sfsf321sfsf21; Version=1; Comment=""; Domain=localhost; Path=/ <------------------------------------???
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:http://product1.com:9090
Content-Encoding:gzip
Content-Type:application/json
Date:Mon, 13 Nov 2017 12:38:27 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked
Vary:Origin
Vary:Accept-Encoding
For Product2 :
Request URL:http://localhost:8080/admin-web/rest/authenticate/
Request Headers
Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Content-Length:156
Content-Type:application/json;charset=UTF-8
Host:localhost:8080
Origin:http://product2.com:9090
Pragma:no-cache
Referer:http://product2.com:9090/p2/
token:null <------------------------------------???
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36
While doing product2 authentication after product1 authentication, token found null. If I deploy product1 on same domain, it works fine.
So, I want to use token header for same service url in another product request. How can I do it? Please find my CORS configuration below :
<filter>
<filter-name>CORS</filter-name>
<filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class>
<init-param>
<param-name>cors.allowOrigin</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.supportedMethods</param-name>
<param-value>GET, HEAD, POST, OPTIONS, PUT, DELETE</param-value>
</init-param>
</filter>
java angularjs rest cookies cors
java angularjs rest cookies cors
edited Nov 15 '17 at 5:29
Darshan Patel
asked Nov 14 '17 at 6:45
Darshan PatelDarshan Patel
2,00211630
2,00211630
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have resolved this by creating subdomain for each product just like Google, where I can share cookies across subdomain.
Reference Share cookie between subdomain and domain
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47279272%2fcentralized-session-in-multiple-product-having-different-domain%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have resolved this by creating subdomain for each product just like Google, where I can share cookies across subdomain.
Reference Share cookie between subdomain and domain
add a comment |
I have resolved this by creating subdomain for each product just like Google, where I can share cookies across subdomain.
Reference Share cookie between subdomain and domain
add a comment |
I have resolved this by creating subdomain for each product just like Google, where I can share cookies across subdomain.
Reference Share cookie between subdomain and domain
I have resolved this by creating subdomain for each product just like Google, where I can share cookies across subdomain.
Reference Share cookie between subdomain and domain
edited Nov 21 '18 at 7:31
piet.t
10.1k73246
10.1k73246
answered Mar 14 '18 at 13:22
Darshan PatelDarshan Patel
2,00211630
2,00211630
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f47279272%2fcentralized-session-in-multiple-product-having-different-domain%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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