1. In the web.config file find the wsFederation element and change the requireHttps property to true
2. Make sure the issuer and realm properties of the wsFederation element are set to "http://localhost". This way the correct domain is resolved dynamically:
<wsFederation passiveRedirectEnabled="true" issuer="http://localhost" realm="http://localhost" requireHttps="true" />
3. Open the ~/App_Data/Sitefinity/Configuration/SecurityConfig.config file
4. Under <securityTokenIssuers> create another entry with the same key. Change only the realm to "https://domain.com"
5. Under <relyingParties> create another entry with the same key and change only the realm to "https://domain.com"
6. Restart the application.