s7nio / de-th-wildau-im14-project-webapp

TH-Wildau - WIR - IM14 - WebApp - Java EE security project
0 stars 0 forks source link

https #16

Closed s7nio closed 10 years ago

s7nio commented 10 years ago
  1. add https (configuration)
  2. use https by default
s7nio commented 10 years ago

Documentation

1. create cert

open terminal navigate to /standalone/configuration

keytool -genkey -alias server -keyalg RSA -keystore server.keystore -validity 365

2. standalone(-full/-ha).xml

  <security-realms>
       <security-realm name="httpsRealm">
            <server-identities>
                <ssl>
                    <keystore path="server.keystore" relative-to="jboss.server.config.dir" keystore-password="PASSWORD" key-password="PASSWORD"/>
                </ssl>
            </server-identities>
        </security-realm>
        ...
  </security-realms>
 ...
 <subsystem xmlns="urn:jboss:domain:undertow:1.0">
 ...
 <server name="default-server">
     <https-listener name="https" socket-binding="https" security-realm="httpsRealm"/>
    ...
 </server>
 ...
</subsystem>
...

3. web.xml

    <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
            <!-- force https -->
            <init-param>
                    <param-name>protocoll</param-name>
                    <param-value>https</param-value>
            </init-param>
   </servlet>
   ...
   <security-constraint>
    <web-resource-collection>
        <web-resource-name>Viewpoint Secure URLs</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
  </security-constraint>
  ...
 <socket-binding-group ...>
     <socket-binding name="https" port="${jboss.https.port:8443}"/>
 ....

4. done

https://localhost:8443/was/

s7nio commented 10 years ago

Links: https://docs.jboss.org/author/display/WFLY8/Security+Realms http://blog.arrow-tech.vn/tag/wildfly/ http://stackoverflow.com/questions/24305910/how-to-add-https-listener-to-wildflys-default-server