-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run authentication example as part of CI #449
Comments
we have a working example for WAMP-CRA auth here: https://github.com/crossbario/autobahn-java/blob/master/demo-gallery/src/main/java/io/crossbar/autobahn/demogallery/AuthenticationExampleClient.java could you try that and see if it works for you? |
Hi, I have the following code in the android app in which I try to connect to the server via wamp-cra, when trying to connect the server gives out an error that is not the correct password
CODE:
try {
Session session = new Session();
session.addOnConnectListener(this::onConnectCallback);
session.addOnJoinListener(this::onJoinCallback);
session.addOnLeaveListener(this::onLeaveCallback);
session.addOnDisconnectListener(this::onDisconnectCallback);
Client client = new Client(session, url, realm, new ChallengeResponseAuth(authid, secret));
CompletableFuture<ExitInfo> exitFuture = client.connect();
try {
ExitInfo exitInfo = exitFuture.get();
Log.d(LOG_TAG, exitInfo.toString());
} catch (Exception e) {
Log.d(LOG_TAG, e.getMessage());
}
} catch (Exception e) {
Log.d(LOG_TAG, "Wamp session start error: ", e);
} LOG:
D/io.crossbar.autobahn.websocket.WebSocketReader: Created
D/io.crossbar.autobahn.websocket.WebSocketConnection: WS reader created and started
D/io.crossbar.autobahn.websocket.WebSocketReader: Running
D/io.crossbar.autobahn.websocket.WebSocketWriter: Created
D/io.crossbar.autobahn.websocket.WebSocketConnection: WS writer created and started
D/io.crossbar.autobahn.websocket.WebSocketReader: Status: 101 (Switching Protocols)
'Server'='nginx/1.10.3'
'Date'='Tue, 15 Oct 2019 09:40:25 GMT'
D/io.crossbar.autobahn.websocket.WebSocketReader: 'Connection'='upgrade'
'Upgrade'='websocket'
'Sec-WebSocket-Accept'='pYQRqc6spmFBw6hIPhKz67BfZZA='
'Sec-WebSocket-Protocol'='wamp.2.json'
D/io.crossbar.autobahn.websocket.WebSocketConnection: opening handshake received
D/io.crossbar.autobahn.wamp.transports.AndroidWebSocket: Negotiated serializer=wamp.2.json
W/Java7Support: Unable to load JDK7 types (annotations, java.nio.file.Path): no Java7 support added
D/io.crossbar.autobahn.wamp.Session: onConnect()
D/WAMP_log: Start session=0
D/io.crossbar.autobahn.wamp.Session: Called join() with realm=UVO
>> TX : ***@***.***
D/io.crossbar.autobahn.websocket.WebSocketConnection: onOpen() called, ready to rock.
D/io.crossbar.autobahn.wamp.Session: <<< RX : io.crossbar.autobahn.wamp.messages.Challenge@455ca1c
D/io.crossbar.autobahn.wamp.Session: >>> TX : io.crossbar.autobahn.wamp.messages.Authenticate@9c3c625
D/io.crossbar.autobahn.wamp.Session: <<< RX : io.crossbar.autobahn.wamp.messages.Abort@458d3fa
D/WAMP_log: Left reason=wamp.error.authorization_failed, message=invalid password
D/io.crossbar.autobahn.wamp.Session: Notified Session.onLeave listeners, now closing transport
D/io.crossbar.autobahn.websocket.WebSocketConnection: WebSockets Close received (1000 - null)
D/io.crossbar.autobahn.websocket.WebSocketReader: Quit
D/io.crossbar.autobahn.websocket.WebSocketWriter: Ended
D/io.crossbar.autobahn.websocket.WebSocketReader: Ended
D/io.crossbar.autobahn.websocket.WebSocketReader: Quit
D/io.crossbar.autobahn.wamp.transports.AndroidWebSocket: Disconnected, code=1, reasons=null
D/io.crossbar.autobahn.wamp.Session: onDisconnect(), wasClean=true
D/WAMP_log: Session with ID=0, disconnected.
D/io.crossbar.autobahn.wamp.Session: Notified all Session.onDisconnect listeners.
I/System.out: io.crossbar.autobahn.wamp.types.ExitInfo@7c49dab
Среда, 16 октября 2019, 12:15 +03:00 от Tobias Oberstein ***@***.***>:
we have a working example for WAMP-CRA auth here: https://github.com/crossbario/autobahn-java/blob/master/demo-gallery/src/main/java/io/crossbar/autobahn/demogallery/AuthenticationExampleClient.java
could you try that and see if it works for you?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or unsubscribe .
С уважением,
Олег Борисов
|
this example not work for me(( |
Tell me please, maybe there are some working examples under android to connect with wamp-cra? |
what exactly does not work?
also: what router? if crossbar, pls include output from |
the password is valid, I have a client on a python using a crossbar that also via wamp-cra connects to the same router without problems. Router - modified turnpike library implementation on golang
my working python code example:
import asyncio
from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp import auth
from pprint import pprint
USER = 'user'
USER_SECRET = '123456'
class Component(ApplicationSession):
def onConnect(self):
print("Client session connected. Starting WAMP-CRA authentication as user '{}'".format(USER))
self.join(u'XXX', [u'wampcra'], USER)
def onChallenge(self, challenge):
print('Authentication challenge received')
key = auth.derive_key(USER_SECRET,
challenge.extra['salt'],
challenge.extra['iterations'],
challenge.extra['keylen'])
signature = auth.compute_wcs(key, challenge.extra['challenge'])
return signature
async def onJoin(self, details):
pass
def onDisconnect(self):
pass
if __name__ == '__main__':
url = u"wss://xxx.ru/ws/"
realm = u"XXX"
try:
runner = ApplicationRunner(url, realm)
runner.run(Component)
except Exception as e:
print(e)
Пятница, 18 октября 2019, 15:02 +03:00 от Tobias Oberstein ***@***.***>:
>this example not work for me((
what exactly does not work?
invalid password in the log gives a hint;)
also: what router? if crossbar, pls include output from crossbar version ..
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or unsubscribe .
С уважением,
Олег Борисов
|
@om26er to cut down in time spent, we should add https://github.com/crossbario/autobahn-java/blob/master/demo-gallery/src/main/java/io/crossbar/autobahn/demogallery/AuthenticationExampleClient.java to the CI tests automatically run that is, test (from ABJ under netty) that all 3 auth methods do work: WAMP-CRA, WAMP-Cryptosign, WAMP-Ticket against the CB started as part of the CI. essentially extend CI so these auth tests can be looked at as part of the travis log https://travis-ci.org/crossbario/autobahn-java |
Works for me, here is the code that I used in android to test
And here is the config
|
Trying to log in to the server via wampcra on the wamp server, when attempting to authorize in the log error:### Left reason = wamp.error.authorization _ failed, message = invalid password, though via autobahn-python everything works fine, password correct. Here is my authorization code:
The text was updated successfully, but these errors were encountered: