Where do i find the JOSSO database configuration file? - java

We have Josso authentication on our website and recently we changed the mysql server and now are in the process of upgrading all the mysql hostnames, usernames and passwords in the database configuration files.
However, a critical component of our site - Josso is still nonfunctional because we have no idea where the database configuration file of josso exists.
I would really appreciate anything that helps me figure out where this is located.
Here is the URL of the site through which it is trying to access Josso :
https://www.mysite.com:8443/josso/signon/usernamePasswordLogin.do;jsessionid=97FACC232630E8A8B93B141A67FBE01C
Edit : We are using Tomcat 6 located under /etc/tomcat6 and also has a server.xml file inside it. I could not find anything relevant related to josso db settings there.

Hopefully you've already figured this out, but this should be documented for others. This documentation is available at the JOSSO wiki, database section.
Assuming JOSSO 1.8.x, there is either a file in $TOMCAT_HOME/lib, which is where we have our configuration, or in $TOMCAT_HOME/webapps/josso/WEB-INF/classes called josso-gateway-db-stores.xml. If you cannot find this file, look for josso-gateway-config.xml which will have the various import statements for the other parts of the gateway configuration. The store configuration contains elements which reference a dsJndiName. This is the datasource that is either defined in you META-INF/context.xml file or in Tomcat's server.xml as a Resouce element.

Related

how to point spring cloud config server to a folder decided by client if git is the version control

Am trying spring cloud config server and client as stand-alone separate applications.
on git, i have folder structure like below-
my-config
----projectfolder1
--------application.properties
----projectfolder2
--------application.properties
I would like that spring cloud client named "projectfolder1" should search application.properties within projectfolder1 on git from spring cloud server i.e
----projectfolder1
--------application.properties
and client "projectfolder2" should get the below mentioned properties from spring cloud config server
----projectfolder2
--------application.properties
My Spring Cloud Config server application.properties has-
spring.cloud.config.server.git.search-paths='{application}'
projectfolder1 in its bootstrap.properties has
spring.application.name=projectfolder1
and projectfolder2 in its bootstrap.properties has
spring.application.name=projectfolder2
According to spring cloud config documentation '{application}' in search path should find the files within the "resolved application name" folder on git. But the above '{application}' doesn't work for me. Clients projectfolder1 and projectfolder2 are not able to get any property at all.
pls assist. i know its possible duplicate of another question on stack overflow. but that question is not resolved and i do not have rights to comment on any question being a new user, So i created this as another question here.
I solved it myself.
The trick is to give search-path {application} without quotes as given below.
It was a little tricky as spring documentation mentions it as '{application}' , probably spring developers just wanted to highlight it with quotes.
spring.cloud.config.server.git.search-paths={application}
instead of
spring.cloud.config.server.git.search-paths='{application}'

how to add a parameter to spring project before <projectname>/login and after <localhost>:<portnumber> without hardcode?

I'm working on a Spring MVC project. When I run the application the URL is:
http://localhost:8080/insureYou/login
but I want:
http://localhost:8080/contextroot/insureYou/login
Is there any way of doing it without hardcoding?
In a spring-boot project you can set the context-root by specifying the following property in the application.properties file:
server.servlet.context-path=/yourcontextroot
Without spring-boot, it depends on the webserver and Tomcat offers a number of options.
I would personally opt for a META-INF/context.xml file in your war file containing the necessary information but you can also include the information in the server.xml file or in a ROOT.xml file.
See the following links for further guidance:
How to set the context path of a web application in Tomcat 7.0
https://tomcat.apache.org/tomcat-8.0-doc/config/context.html
https://www.baeldung.com/tomcat-root-application
This type of deployment however sometimes is handled separately, through an Apache server reverse-proxy or through URL rewriting.
I recommend you ascertain whether this type of need is already taken care of by your company's deployment procedures, as you may not need to deal with it at all.

How to allow any user in JBoss config

I have an access problem in a Java web application and I think that it's because of the rights of JBoss.
I'm using JBoss 7.1. I found the files application-roles.properties and application-users.properties and I think that it's where we must assign the rights. Actually, I have nothing in these files.
I've searched about this conf but I don't find anything which can help me.
Can anybody help me to give all rights to any users please ? And maybe explain me how it works please.
Just adding users to file is not going to do the trick. Here are the basic steps in adding authentincation and authorization in Java Web App.
Create a login module and define a JNDI name for the login module in
the Java application server. There are many login modules to choose
from such as LDAP, Database, UserProperties, Certificate, etc. This is where you can point the login module to the application-user.properties for principal authentication and application-roles.properties for the roles definitions.
Then you need to add proper web application security-constraints in your web.xml along with authentication type of basic or form. This is pretty standard configuration.
Finally, add the login module JNDI name in the jboss-web.xml file under WEB-INF (for a WAR file) or META-INF (for a JAR or an EAR file).
You can follow along this example if you are planning to use the application-user and roles file for your application. Most organizations usually use LDAP or Database type of login modules for authentication since that's more scalable and secured. You can see a list of few other login modules here.

Easiest way to deploy web app to Apache Tomcat

I'm trying to deploy my first servlet to my server. There are, of course, many tutorials online. But most of them are very detailed and complicated, and I only need to deploy a few simply servlets to this server.
I found what I think to be the shortest method of deployment: Deployment on Tomcat Startup. I moved my .WAR file (FirstProject.war) into $CATALINA_BASE/webapps folder, but when trying to access it (ServerIP/FirstProject) I get the "The requested resource is not available." error.
Is there anything I forgot in the process of deployment?
I know that deployOnStartup has to be set to true, but I didn't change anything with the server's hosts, so the current host is localhost. I didn't change its settings, so deployOnStartup should be true (It's said that true is the default).
What am I missing?
You are using easiest way but I don't know what you are missing. Here what I would suggest is run your server and access through localhost:8080 then click manage app then enter username and password then you can deploy your war.
If you have any query post command.
Even i used to face this problem while deploying my first web application on Jboss and Apache ..
Even though your code is working properly with all your servlet mappings and paths using in your content files ...some times they kick back in real time environment ..So we have to know the proper deployment folder structure and accordingly we have to change our paths in the code
what i am concluding is check the below lines of code
Examples, assuming root is http://foo.com/site/
Absolute path, no matter where we are on the site
/foo.html
will refer to http://foo.com/site/foo.html
Relative path, assuming the containing link is located in http://foo.com/site/part1/bar.html
../part2/quux.html
will refer to http://foo.com/site/part2/quux.html
or
part2/blue.html
will refer to http://foo.com/site/part1/part2/blue.html

Why is Realm setting required in Server.xml and not web.xml

I am working on a Java application for a while. I primarily work on .NET Platform. Although I feel lot of concepts are common between these two platforms but there are few areas where I am finding some issues related to the configuration.
I am working on Authentication and Authorization and thought I would get something similar to Membership APIs of .NET in JAVA. Closest which I got was using j_security_check. I also got to know about JAAS but think it is little too deep for me to dive into.
I have created the user and role tables in the database and now I have to specify the JDBC Realm settings somewhere. I am using Tomcat 7.0. In most places, it's mentioned that I need to specify the realm setting in the server.xml.But wouldn't that apply to all web application deployed on that server since it would become a server level configuration ?.
On a site I even saw a developer mentioning about context.xml but again can't see a standard document that mention about using this XML file for setting JDBC realm
In.NET, We always put Membership settings at the web.config level and not Machine.config.
Totally Confused on this. Looking for some light on this.
Why is Realm setting required in Server.xml and not web.xml
This is not true, you can define it in your webapp as well, but then only in a servletcontainer-specific configuration file, such as /META-INF/context.xml in case of Tomcat. It cannot be definied in /WEB-INF/web.xml because it's specific to the standard Servlet API, not the servletcontainer implementation.
But wouldn't that apply to all web application deployed on that server since it would become a server level configuration ?.
That's correct. This is not recommended if you have no control over the server or if you don't want to publish the realm through other webapps.
On a site I even saw a developer mentioning about context.xml but again can't see a standard document that mention about using this XML file for setting JDBC realm
You can specify it in webapp's /META-INF/context.xml. See also Tomcat's own documentation on the <Context> element:
Defining a context
It is NOT recommended to place <Context> elements directly in the server.xml file. This is because it makes modifying the Context configuration more invasive since the main conf/server.xml file cannot be reloaded without restarting Tomcat.
Individual Context elements may be explicitly defined:
In an individual file at /META-INF/context.xml inside the application files. Optionally (based on the Host's copyXML attribute) this may be copied to $CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to application's base file name plus a ".xml" extension.
In individual files (with a ".xml" extension) in the $CATALINA_BASE/conf/[enginename]/[hostname]/ directory. The context path and version will be derived from the base name of the file (the file name less the .xml extension). This file will always take precedence over any context.xml file packaged in the web application's META-INF directory.
Inside a Host element in the main conf/server.xml.
(emphasis is not mine, it is already as such in Tomcat's documentation)

Categories

Resources