howto.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. $Id$
  2. CAS requires HTTPS be used for all operations, with the certificate used
  3. having been signed by a certificate in the cacerts files shipped with Java.
  4. If you're using a HTTPS certificate signed by a well known authority
  5. (like Verisign), you can safely ignore the procedure below (although you
  6. might find the troubleshooting section at the end helpful).
  7. The following demonstrates how to create a self-signed certificate and add
  8. it to the cacerts file. If you just want to use the certificate we have
  9. already created and shipped with the Acegi Security System for Spring, you
  10. can skip directly to step 3.
  11. 1. keytool -keystore keystore -alias acegisecurity -genkey -keyalg RSA -validity 9999 -storepass password -keypass password
  12. What is your first and last name?
  13. [Unknown]: localhost
  14. What is the name of your organizational unit?
  15. [Unknown]: Acegi Security System for Spring
  16. What is the name of your organization?
  17. [Unknown]: TEST CERTIFICATE ONLY. DO NOT USE IN PRODUCTION.
  18. What is the name of your City or Locality?
  19. [Unknown]:
  20. What is the name of your State or Province?
  21. [Unknown]:
  22. What is the two-letter country code for this unit?
  23. [Unknown]:
  24. Is CN=localhost, OU=Acegi Security System for Spring, O=TEST CERTIFICATE ONLY. D
  25. O NOT USE IN PRODUCTION., L=Unknown, ST=Unknown, C=Unknown correct?
  26. [no]: yes
  27. 2. keytool -export -v -rfc -alias acegisecurity -file acegisecurity.txt -keystore keystore -storepass password
  28. 3. copy acegisecurity.txt %JAVA_HOME%\lib\security
  29. 4. copy keystore %YOUR_WEB_CONTAINER_LOCATION%
  30. NOTE: You will need to configure your web container as appropriate.
  31. We recommend you test the certificate works by visiting
  32. https://localhost:8443. When prompted by your browser, select to
  33. install the certificate.
  34. 5. cd %JAVA_HOME%\lib\security
  35. 6. keytool -import -v -file acegisecurity.txt -keypass password -keystore cacerts -storepass changeit -alias acegisecurity
  36. Owner: CN=localhost, OU=Acegi Security System for Spring, O=TEST CERTIFICATE ONL
  37. Y. DO NOT USE IN PRODUCTION., L=Unknown, ST=Unknown, C=Unknown
  38. Issuer: CN=localhost, OU=Acegi Security System for Spring, O=TEST CERTIFICATE ON
  39. LY. DO NOT USE IN PRODUCTION., L=Unknown, ST=Unknown, C=Unknown
  40. Serial number: 4080daf4
  41. Valid from: Sat Apr 17 07:21:24 GMT 2004 until: Tue Sep 02 07:21:24 GMT 2031
  42. Certificate fingerprints:
  43. MD5: B4:AC:A8:24:34:99:F1:A9:F8:1D:A5:6C:BF:0A:34:FA
  44. SHA1: F1:E6:B1:3A:01:39:2D:CF:06:FA:82:AB:86:0D:77:9D:06:93:D6:B0
  45. Trust this certificate? [no]: yes
  46. Certificate was added to keystore
  47. [Saving cacerts]
  48. 7. Finished. You can now run the sample application as if you purchased a
  49. properly signed certificate. For production applications, of course you should
  50. use an appropriately signed certificate so your web visitors will trust it
  51. (such as issued by Thawte, Verisign etc).
  52. TROUBLESHOOTING
  53. * First of all, most CAS-Acegi Security problems are because of untrusted
  54. SSL certificates. So it's important to understand why. Most people can
  55. load the Acegi Security webapp, get redirected to the CAS server, then
  56. after login they get redirected back to the Acegi Security webapp and
  57. receive a failure. This is because the CAS server redirects to something
  58. like https://server3.company.com/webapp/j_acegi_cas_security_check?ticket=ST-0-ER94xMJmn6pha35CQRoZ
  59. which causes the "service ticket" (the "ticket" parameter) to be validated.
  60. net.sf.acegisecurity.providers.cas.ticketvalidator.CasProxyTicketValidator
  61. performs service ticket validation by delegation to CAS'
  62. ProxyTicketValidator class. The ProxyTicketValidator class will perform a
  63. HTTPS connection from the web server running the Acegi Security webapp
  64. (server3.company.com) above to the CAS server. If for some reason the
  65. web server keystore does not trust the HTTPS certificate presented by the
  66. CAS server, you will receive various failures as discussed below. NB: This
  67. has NOTHING to do with client-side (browser) certificates. You need to
  68. correct the trust between the two webserver keystores alone.
  69. * A "sun.security.validator.ValidatorException: No trusted certificate
  70. found" indicates the cacerts is not being used or it did not correctly
  71. import the certificate. To rule out your web container replacing or in
  72. some way modifying the trust manager, set the
  73. CasProxyTicketValidator.trustStore property to the full file system
  74. location to your cacerts file.
  75. * If your web container is ignoring your cacerts file, double-check it
  76. is stored in $JAVA_HOME\lib\security\cacerts. $JAVA_HOME might be
  77. pointing to the SDK, not JRE. In that case, copy
  78. $JAVA_HOME\jre\lib\security\cacerts to $JAVA_HOME\lib\security\cacerts