set Multiple "jwk-set-uri" for my spring resource server - spring-boot

I have been developing this mobile app for a long time now which uses microservices architecture on the backend ( spring boot 2.4.2 ) . I have been able to set my microservices as resource servers which validate google tokens and everything works as expected in android version . Incidentally , I'm working on ios version and apple store imposes a rule to add apple sign in feature to my app .
Currently google sign in is working just fine with this line in application.properties file :
spring.security.oauth2.resourceserver.jwt.jwk-set-uri = https://www.googleapis.com/oauth2/v3/certs
However with this apple store rule I have to set another jwk-set-uri "https://appleid.apple.com/auth/keys" .
So my resource server can validate both token types apple and google .
How can I just Do that exactly . I have been looking on the web for a precise solution but with no avail .
Can someone please help me out . Any kind of help would be much appreciated .
Cheers .

Related

ERR_SSL_UNRECOGNIZED_NAME_ALERT when trying to access my heroku app

I created a sandbox Angular application on Heroku.
The application is available (using the default https://mysampleapp.herokuapp.com ) and I want to have my domain name pointing to this application.
I followed the custom domain documentation to add a custom sub domain: https://devcenter.heroku.com/articles/custom-domains#configuring-dns-for-subdomains
In my Heroku application settings i can see the added domain :
www.mydomain.fr --> something-somethingelse-1234567890.herokudns.com
Then in my DNS provider, I removed my previous "A" / "CNAME" entries (no need anymore) and I added one :
CNAME / www.mydomain.fr. / something-somethingelse-1234567890.herokudns.com.
Using https://zone.vision/#/www.mydomain.fr , I can correctly see the DNS responding:
When trying to reach my app using the browser and the url www.mydomain.fr, I am getting an ERR_SSL_UNRECOGNIZED_NAME_ALERT error message.
Do you know what I am missing ?
I am using a single free application on Heroku, without any certificates.
Thank you in advance.
Found the root cause: I needed to enable ACM: https://devcenter.heroku.com/articles/automated-certificate-management

Get and Post doesnt respond after deploying to heroko

Good day ,
I am very new to node.js . deployed my application through heroko and yet all the get and post requests which works fine doesn't work .
i ran the console they provide and got the port from a console log which they assign to a random environment variable yet postman says no response .
this is my git repo
https://github.com/a7medsharaf/Bank_App
the problem is i don't know what to do next
Edit :
After multiple trials and using the dotenv package turns out that heroko ignores your setting and you dont have to add a port to the API url . just use it without port and it worked !!

How to host Spring boot application on cpanel?

I have a Spring boot application and i want to host it in my VPS server (cpanel).
I'am using the last version of cpanel & WHM with easyapache 4.
I exactly followed the steps on this website : https://dzone.com/articles/deploying-war-file-in-easy-apache-4-tomcat-experim
But, nothing on the result. I got Error 404 when i access to my domain name.
If anyone can help me on this or anyone done this before could give the exact steps to follow.
Thank you.
I had difficulty with that too, use the link in the attachment that you will have an orientation, but it may be that not everything is 100% the same. If you have any questions during the process, you can contact!
change the name of the .war file to ROOT.war , and follow all the procedures described in the link;
In the "application.properties" file, add the "server.port" configuration for the port you found in the link (step 2, part 1).
ex: server.port=10003
Open the file "ea-tomcat85/logs/catalina.out" to see the errors thrown
link: https://suporte.hostgator.com.br/hc/pt-br/articles/360038980913-Como-configurar-o-Tomcat-

An invalid domain was specified for this cookie

I use Spring Boot 1.4.4.RELEASE in my application and my application is been deployed in AWS.
I am trying to have subdomain for each user like,
when user "test" logs in, the url will be test.XXX.com
Here XXX.com is my domain name.
For XXX.com, it works fine.
I recently bought one more domain for testing like XXX-test.com.
But, when an user logs in, I am getting the below exception.
java.lang.IllegalArgumentException: An invalid domain [.XXX-test.com] was specified for this cookie
at org.apache.tomcat.util.http.Rfc6265CookieProcessor.validateDomain(Rfc6265CookieProcessor.java:183)
at org.apache.tomcat.util.http.Rfc6265CookieProcessor.generateHeader(Rfc6265CookieProcessor.java:125)
at org.apache.catalina.connector.Response.generateCookieString(Response.java:989)
at org.apache.catalina.connector.Response.addSessionCookieInternal(Response.java:959)
at org.apache.catalina.connector.Request.doGetSession(Request.java:3009)
at org.apache.catalina.connector.Request.getSession(Request.java:2367)
at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:896)
at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:231)
at org.springframework.security.web.context.HttpSessionSecurityContextRepository$SaveToSessionResponseWrapper.createNewSessionIfAllowed(HttpSessionSecurityContextRepository.java:427)
at org.springframework.security.web.context.HttpSessionSecurityContextRepository$SaveToSessionResponseWrapper.saveContext(HttpSessionSecurityContextRepository.java:364)
at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.onResponseCommitted(SaveContextOnUpdateOrErrorResponseWrapper.java:85)
at org.springframework.security.web.util.OnCommittedResponseWrapper.doOnResponseCommitted(OnCommittedResponseWrapper.java:245)
at org.springframework.security.web.util.OnCommittedResponseWrapper.sendRedirect(OnCommittedResponseWrapper.java:127)
at javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:138)
at org.springframework.security.web.util.OnCommittedResponseWrapper.sendRedirect(OnCommittedResponseWrapper.java:128)
at org.springframework.security.web.DefaultRedirectStrategy.sendRedirect(DefaultRedirectStrategy.java:57)
My Spring application.properties,
server.session.cookie.domain=.XXX-test.com
server.session.cookie.path=/
It works fine for other prod env with the below config.
server.session.cookie.domain=.XXX.com
server.session.cookie.path=/
Again, the prod config was deployed and tested few months ago with the spring boot version of 1.3.5.
Is there anything changed or anything missing here? Or, XXX-test.com is an issue?
Thanks,
According to RFC 6265 ( https://www.rfc-editor.org/rfc/rfc6265) starting with a . (dot) character may cause problems.
You could try to fallback to the LegacyCookieProcessor, see: How to change Cookie Processor to LegacyCookieProcessor in tomcat 8 for more info .
If you still have problems please inform us about your TC version.

Deploy WSO2 Enterprise App Store in EC2 using ELB

I am deploying the WSO2 Enterprise App Store into EC2 behind an elastic load balancer (ELB) and having some trouble getting things configured properly.
I have configured $INSTALL_PATH/repository/conf/carbon.xml with the proper HostName and MgtHostName of the ELB DNS name and I can get to the front-end of the app store and to the admin console.
I am unable to:
get user registrations working throuth the front end app store
get to the back-office console
The issue appears to be in routing requests to the identity service. I get an error like the following:
You are now being redirected to Identity Server. If the redirection fails, please click on the button below.
I then get a timeout on the redirect to this RFC1918, non-routed, address:
https://10.x.x.x:9443/adminsamlsso
I see no errors in the logs on startup or throughout execution of the application.
How can I configure this application such that all requests are re-routed through the AWS ELB (not the WSO2 load balancer) and not through the direct, local, IP address?
Please modify following configurations as well,
Update the AssertionConsumerService property for all apps(store, publisher, social) within /repository/conf/sso-idp-config.xml
You can find few jaggery apps within /repository/deployment/server/jaggeryapps/ directory. Each app has its own json config file within config directory.
Eg :- for store app /repository/deployment/server/jaggeryapps/store/config/store.json
You have to update the identityProviderURL property within ssoConfiguration in those apps as well.(store, publisher and social)
If you are using ES-1.0.0 It's better if you can move to the latest 1.2.0 M2.
We also faced similar issue and now fixed in the master branch.
If you need to continue with the same 1.0.0 you can get rid of this issue by updating,
<ES_HOME>/repository/deployment/server/jaggeryapps/store/controllers/login.jag, <ES_HOME>/repository/deployment/server/jaggeryapps/publisher/controllers/login.jag
<ES_HOME>/repository/deployment/server/jaggeryapps/store/controllers/logout.jag, <ES_HOME>/repository/deployment/server/jaggeryapps/publisher/controllers/logout.jag
You have to update the postUrl in above four files correctly.
NOW : postUrl = "https://" + process.getProperty('carbon.local.ip') + ":" + process.getProperty('https.port');
It should be something like https://localhost:9443/
At the end post URL should be something like https://localhost:9443/admin/samlsso
<form method="post" action="<%=postUrl%>/admin/samlsso">

Resources