diff --git a/README.md b/README.md index 65e2899..d35bb93 100644 --- a/README.md +++ b/README.md @@ -40,3 +40,17 @@ if (isset($_GET['code']) && $_GET['code']) { // $user->profile_url = [ Full URL to profile on battle.net ] } ``` + +Testing +-------- + +There is a simple scaffold for an integration test in `test/`. Unfortunately, it is nontrivial to use, as +the Battle.net OAuth service *requires* the use of `https` for all authentication traffic (but that does bode well for +security!) + +Included is an SSL certificate as well as a private key for use with the domain `oauth2-bnet.local`. Simply add `oauth2-bnet.local` +to your `/etc/hosts` as an alias for localhost, and configure apache to serve the files in `test/` using the certificate +and key files in `test/ssl`. + +Next edit `test/config.php` to fill in the values for your own client key from https://dev.battle.net and you should be able +to run the test. The page should redirect you to log in, and then dump your user values to screen if successful. diff --git a/test/ssl/server.crt b/test/ssl/server.crt new file mode 100644 index 0000000..f3cfaea --- /dev/null +++ b/test/ssl/server.crt @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE----- +MIICxzCCAjACCQD48HdWIk317zANBgkqhkiG9w0BAQsFADCBpzELMAkGA1UEBhMC +Q0ExEDAOBgNVBAgMB0FsYmVydGExETAPBgNVBAcMCEVkbW9udG9uMSQwIgYDVQQK +DBtEZXBvdHdhcmVob3VzZSBTb2Z0d2FyZSBJbmMxETAPBgNVBAsMCFNvZnR3YXJl +MRowGAYDVQQDDBFvYXV0aDItYm5ldC5sb2NhbDEeMBwGCSqGSIb3DQEJARYPdHJv +eUB0cGF2bGVrLm1lMB4XDTE1MDUyMDE4MTYwMVoXDTQwMDExMDE4MTYwMVowgacx +CzAJBgNVBAYTAkNBMRAwDgYDVQQIDAdBbGJlcnRhMREwDwYDVQQHDAhFZG1vbnRv +bjEkMCIGA1UECgwbRGVwb3R3YXJlaG91c2UgU29mdHdhcmUgSW5jMREwDwYDVQQL +DAhTb2Z0d2FyZTEaMBgGA1UEAwwRb2F1dGgyLWJuZXQubG9jYWwxHjAcBgkqhkiG +9w0BCQEWD3Ryb3lAdHBhdmxlay5tZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC +gYEAv++wxegh7Zsaab+wFEt8D9zUX+u3lHPIap1BMJdslW/G8LLMUMZCQEwzMYY5 +c987fx8p/Dtoc+UgiH6akN7s01E3WtBQY2LlsKqoFezJmC2f7u50q+mVgEPIRVQZ +4vFs9g0jw7ZrH5CqTukCwlSVCBrqMOwzemq1ZumvRzo62ysCAwEAATANBgkqhkiG +9w0BAQsFAAOBgQADcH3H3xZ2YkNPi5fGKFSqhluQgIuDd+emU9AQZ3YWCQzKHXYq +VLyLmYydLIStSaz10jE557QfaY+oBsgKcdfXqgbwXC4jvLpd4j0UVjzV30d/rz2a +haGAPz0xNnJl6N5xHIzG5NtCT7AtyaiHvVMNOjUkCjWU9HIyluXgSrjo6w== +-----END CERTIFICATE----- diff --git a/test/ssl/server.csr b/test/ssl/server.csr new file mode 100644 index 0000000..1b9c6f9 --- /dev/null +++ b/test/ssl/server.csr @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIB6DCCAVECAQAwgacxCzAJBgNVBAYTAkNBMRAwDgYDVQQIDAdBbGJlcnRhMREw +DwYDVQQHDAhFZG1vbnRvbjEkMCIGA1UECgwbRGVwb3R3YXJlaG91c2UgU29mdHdh +cmUgSW5jMREwDwYDVQQLDAhTb2Z0d2FyZTEaMBgGA1UEAwwRb2F1dGgyLWJuZXQu +bG9jYWwxHjAcBgkqhkiG9w0BCQEWD3Ryb3lAdHBhdmxlay5tZTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEAv++wxegh7Zsaab+wFEt8D9zUX+u3lHPIap1BMJds +lW/G8LLMUMZCQEwzMYY5c987fx8p/Dtoc+UgiH6akN7s01E3WtBQY2LlsKqoFezJ +mC2f7u50q+mVgEPIRVQZ4vFs9g0jw7ZrH5CqTukCwlSVCBrqMOwzemq1ZumvRzo6 +2ysCAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4GBAEFo9eFrenMLnFstjMnifcDW8Cx0 +unD6Q+5wHdSV8hR0bolCMZ5L4zM1Tbgb+Dfo6KEszbg9ySCZXYCvlUPEJhSxt7ap +HsEEISbR+e8UOpc6WZTAhHLZ8HGCQBI+T+OGXIOYIJh2ej10Z9oVUre050oypNXY +/z6FmYONKjmbranv +-----END CERTIFICATE REQUEST----- diff --git a/test/ssl/server.key b/test/ssl/server.key new file mode 100644 index 0000000..b9e1365 --- /dev/null +++ b/test/ssl/server.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQC/77DF6CHtmxppv7AUS3wP3NRf67eUc8hqnUEwl2yVb8bwssxQ +xkJATDMxhjlz3zt/Hyn8O2hz5SCIfpqQ3uzTUTda0FBjYuWwqqgV7MmYLZ/u7nSr +6ZWAQ8hFVBni8Wz2DSPDtmsfkKpO6QLCVJUIGuow7DN6arVm6a9HOjrbKwIDAQAB +AoGAHcOawyX7VPBviSSbtpn6FC+nk3RnVJMb6kSWnmVtBkN+M0dW3dPQ5E2sxqpM +8IYWoOEBTscbrJVElUYkzAB18w34qi9kMlxgLk22cxCTNWZu3yLPeZu/CisWVymk +2R1o0CqJnKLyEze4SseqylsMEE/4m3/A4V7dcAiM9m4vsKECQQD40DKQJkAnHsXA +G8qqK5KQ30SnO5LdHDKE2kMF4yjyLhpOybg5i1Spiurh6bRrzSzYH19/rOI6BkKy +s2mIDJwxAkEAxXrtTlYsyoMD2z00cCCuFo/O/Lj5VGYCwPUORVjJ6QfBL2HZZa6X +8yZ7R1EGTmJb+ll6oybsBuZVgsDyzQ4CGwJBAJlQuQdn+nnglVvGBECNbtfEK+qc +Y+fJWzvPviLfkbiBPga0d8dFmpqKFie0uU7/85UM5+ylXBUDDJBOy0Vg99ECQQCC +ZVsQoOJOjhgbydw4Nbv99dNNGK65xeoHk0hrDee00YQET24HMDPxP/Wi76NkWpo1 +QqQx2t965tiLz/AC6j8FAkButtf0xVVdO/zuW5LFXFbDzKmWM/oRzAogN/LyXVI8 +J85qu1u/5PFmEKHXSO6QpcFFY4GBQigkt7X/85FjTiOo +-----END RSA PRIVATE KEY-----