Adsense

Sunday, 16 August 2015

Secure Url redirection-https- WildFly-8.2.0


Generate a keystore and self-signed certificate:

Sample certificate created with the following information.

 

$>keytool -genkey -alias mycert -keyalg RSA -sigalg MD5withRSA -keystore my.jks -storepass secret  -keypass secret -validity 9999

 

What is your first and last name?

  [Unknown]:  localhost

What is the name of your organizational unit?

  [Unknown]:  TallJavaThoughts

What is the name of your organization?

  [Unknown]:  TallJavaThoughts.com

What is the name of your City or Locality?

  [Unknown]:  Blr

What is the name of your State or Province?

  [Unknown]:  Kr

What is the two-letter country code for this unit?

  [Unknown]:  IN

Is CN=localhost, OU=TallJavaThoughts, O=TallJavaThoughts.com, L=Blr, ST=Kr, C=In correct?

  [no]:  yes

 

You will get the my.jks created in the current path and the same needs to be placed in wildfly-8.2.0.Final\standalone\configuration.

 

Need to add a new security realm in standalone.xml file as follows:


<security-realm name="UndertowRealm">

                <server-identities>

                    <ssl>

                        <keystore path="my.jks" relative-to="jboss.server.config.dir" keystore-password="secret" alias="mycert" key-password="secret"/>

                    </ssl>

                </server-identities>

            </security-realm>

 

Undertow Subsystem for SSL needs to be configured:


<https-listener name="https" socket-binding="https" security-realm="UndertowRealm"/>

That's it!