Implementing a JAAS page to a WAR file on JBOSS AS 7.1.1 - authentication

I'm very new to web applications. I've been told that JBOSS 7.1.1 has an in-built JAAS system which can be enabled on my JBOSS configuration quite simply. However I'm having trouble trying to get this running, namely most internet searching I went through has just ended up with older versions of JBoss.
Does anyone have a step-by-step guide on how to implement a simple JAAS authentication screen on my WAR file in JBoss 7.1.1? Prefarbly using its h2 database. Thanks :)
Also - my machine has trouble with Eclipse, so I can't use any of Eclipse EE's nifty server running mechanisms.

Finally got it. For those of you in the future:
You need your own standard login/logout pages in jsp/html/whatever. You put that in your web.xml constraints. Then you add an xml file called "Jboss-web" and type in your security domain (the default AS 7 is called 'other'). Then lastly add users and roles using adduser.bat in config folder.

Related

Glassfish workaround to work with OpenAM

The IT dept. in the company where I work uses OpenAM to manage web access over the intranet (SSO solution).
As I'm using Glassfish 4.1, which is a container not supported by OpenAM, is there some workaround that I could use OpenAM, without replacing Glassfish? If so, how can I do it?
Thanks in advance.
When using OpenAM 13.5.0 for example, it is possible to deploy OpenAM to Payara 4.1.2.172 for example with a bit of a compromise.
DISCLAIMER: the following steps allows one to deploy OpenAM to GlassFish/Payara, but this does not mean that this kind of deployment is actually supported by anyone.
So the steps are:
in the WAR file within the WEB-INF/lib/openam-radius-server-13.5.0.jar you'll need to remove the META-INF/INDEX.LIST file
you'll need to edit the WEB-INF/web.xml file and remove both the ws and federationrest servlets and their mappings
to deploy the WAR you'll need to execute this command:
bin/asadmin deploy --name openam --contextroot /openam --property implicitCdiEnabled=false OpenAM-13.5.0.war
It seems that OpenAM cannot be deployed on Payara (Glassfish). Please refer to the blog and the last comment of this issue.
So you may have to use another container, for example, Tomcat.

Weblogic run configuration in IntelliJ idea - disable basic authentication

I need to disable basic auth on weblogic server, which can be done by adding <enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials> into config.xml in a weblogic domain.
I'm deploying a web service to weblogic directly from IntelliJ Idea and every time I start deploy, the config.xml is replaced by a new one, so I cannot change config manually. I guess I need to pass some extra arguments in IntelliJ's run configuration. Does anyone has any experiences with this?
It was my mistake. I tried to modify config.xml and forgot my server is still running. According to this page I think it's pretty obvious why this happens. So, it has nothing to do with IntelliJ Idea.
Caution: Do not edit configuration files for a domain that is
currently running. Because Oracle WebLogic Server rewrites the files
periodically, your changes will be lost. Depending on your platform,
you also could cause Oracle WebLogic Server failures.

GlassFish - Migrate domain from version 3 to version 4

I would like to move a GlassFish domain from a GlassFish v3.x server (running Java 6) to a new server running GlassFish v4.x (running Java 8). The old configuration uses JNDI, JMS, a webservice, etc...
What is the best approach to handle this ? Can I just copy the domain folder to the new server ? Or do I have to export the config and restore it on the new server ?
Thanks
Right now we are doing the same thing in my company.
We were trying a few things like exporting domains, upgrading them or just coping the domain, unfortunately none worked ...
The only solution that worked without problems was coping the "important"
parts like resources from glassfihs 3 domain.xml to glassfish4 domain.xml.
Coping the full domain.xml content or file wont work..

How to reference apache cxf library from apache web server

When I deploy my apache cxf web service using eclipse I have to include the apache cxf library in the Web Deployment Assembly in order for it to work when I deploy it on my production apache web server. This is a problem because it makes the war file very large because the cxf library is included. If I exclude the library the war file is much smaller but the web service does not work when it is deployed on the live server even though the apache cxf library is on the live server.
My assumption is I need some kind of classpath reference so the live server can see the apache cxf installation but I am not familiar with how to do this as I am new to apache.
Thanks, Jesse
Put the cxf jars on folder tomcat/lib.
Ok, this workaround worked for me:
We can set the CXF lib path on the common.loader variable which is in $CATALINA_HOME/conf/catalina.properties file. You can add (after the comma) something like this:
common.loader=....,/path/to/cxf/home/lib/*.jar
I couldn't find a way to set an enviroment variable on tomcat in order to have something like: ${cxf.home}/lib/*.jar. I tried to put -Dcxf.home=$CXF_HOME in several places in catalina.sh but it never picked it up :( - hope someone can help on this later.
Restart tomcat and it will take cxf jars

Global web.xml conf in JBoss 7

In JBoss 4.2.3 we could configure items in
[jboss_server]/deploy/jboss-web.deployer/conf/web.xml
which would be adopted by all applications deployed. We've used this to configure context params, servlets, and default tag files.
We have dozens of apps deployed in war files, and this a very handy tool.
How is this accomplished in JBoss 7.1.1? I've googled and searched but can't seem to find the solution.
You could try web fragments (part of Servlet API 3.x). You'll be able to apply the same set of filters, mappings, listeners, variables to each web app's context using one META-INF/web-fragment.xml file (inside some WEB-INF/lib/my-common-context.jar, so it'd be easily managed as a simple dependency).