ssl - How to use HTTPS with Glassfish 4 and JSF 2.2? -
just learning purposes, want use ssl in application have developed in local environment.
so want connections go through ssl.
how can implement glassfish 4.0 ?
here example of using jaas form authentication:
on web.xml block of code defines urls ssl enabled:
<login-config> <auth-method>form</auth-method> <realm-name>userauth</realm-name> <form-login-config> <form-login-page>/login.jsf</form-login-page> <form-error-page>/loginerror.jsf</form-error-page> </form-login-config> </login-config> <security-constraint> <display-name>constraintssl</display-name> <web-resource-collection> <web-resource-name>protected</web-resource-name> <description/> <url-pattern>/*</url-pattern> <http-method>get</http-method> <http-method>post</http-method> <http-method>head</http-method> <http-method>put</http-method> <http-method>options</http-method> <http-method>trace</http-method> <http-method>delete</http-method> </web-resource-collection> <user-data-constraint> <transport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constraint> now on application server (glassfish) configure authentication realm "userauth" in example:
create-auth-realm --classname com.sun.enterprise.security.ee.auth.realm.jdbc.jdbcrealm --property jaas-context=jdbcrealm:datasource-jndi=oraclexe10gjdbcresource:user- table=tb_user:user-name-column=id_user:password-column=password:group- table=tb_user_group_user:group-name-column=id_group:group_table_user-name- column=id_group:digest-algorithm=md5 userauth in example created jdbc based realm md5 encrypted passwords on user table called "tb_user" along group table names. might create own authentication realm, can file, jdbc or other jaas type (please see jaas doc each specific one).
now requests app shall using ssl.
glassfish redirect ssl port (default 8181) , browser displaying default ssl trust certificate alert window (in case using self-signed certificate) asking if trust connection, , after accepting should see page rendered correctly in ssl mode - https
Comments
Post a Comment