alfresco-api-java-examples
alfresco-api-java-examples copied to clipboard
OAuth2 authentication fails
What steps will reproduce the problem?
1. Running the project in eclipse with GetSitesExample as entry
2. Browser window comes up asking for authorisation, which I provide
3. OAuth2 Authentication fails with a debug message
What is the expected output? What do you see instead?
"javax.net.ssl.SSLException: Server key
at sun.security.ssl.Handshaker.throwSSLException(Handshaker.java:1274)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:223)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:515)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1090)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:80)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1009)
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:299)
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:323)
at com.alfresco.cloud.example.BaseJavaExample.authorize(BaseJavaExample.java:144)
at com.alfresco.cloud.example.BaseJavaExample.run(BaseJavaExample.java:99)
at com.alfresco.cloud.example.GetSitesExample.main(GetSitesExample.java:24)
Caused by: java.security.spec.InvalidKeySpecException: Could not create EC
public key
at sun.security.pkcs11.P11ECKeyFactory.engineGeneratePublic(P11ECKeyFactory.java:169)
at java.security.KeyFactory.generatePublic(KeyFactory.java:334)
at sun.security.ssl.HandshakeMessage$ECDH_ServerKeyExchange.<init>(HandshakeMessage.java:1057)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:218)
... 17 more
Caused by: sun.security.pkcs11.wrapper.PKCS11Exception:
CKR_DOMAIN_PARAMS_INVALID
at sun.security.pkcs11.wrapper.PKCS11.C_CreateObject(Native Method)
at sun.security.pkcs11.P11ECKeyFactory.generatePublic(P11ECKeyFactory.java:233)
at sun.security.pkcs11.P11ECKeyFactory.engineGeneratePublic(P11ECKeyFactory.java:164)
... 20 more"
Please provide any additional information below.
The line
"TokenResponse response =
codeFlow.newTokenRequest(code).setRedirectUri(redirectUri).setScopes(SCOPE).exec
ute();" in BaseJavaExample.java seems to be at fault. I can't figure out what's
wrong though.
Original issue reported on code.google.com by vsams14 on 19 Aug 2013 at 12:33
Did you add your own secret and API key that you set up at
http://www.alfresco.com/develop?
Original comment by jeffpotts01 on 16 Sep 2013 at 3:56