Skip to content
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

Open
oledjiks opened this issue Sep 12, 2019 · 8 comments
Open

run authentication example as part of CI #449

oledjiks opened this issue Sep 12, 2019 · 8 comments
Assignees

Comments

@oledjiks
Copy link

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:

Session session = new Session ();
 IAuthenticator authenticator = new ChallengeResponseAuth(authid, secret);
Client client = new Client(session, url, realm, authenticator);
CompletableFuture<ExitInfo> exitInfoCompletableFuture = client.connect();
@oberstet
Copy link
Contributor

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?

@oledjiks
Copy link
Author

oledjiks commented Oct 16, 2019 via email

@oledjiks
Copy link
Author

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?

this example not work for me((

@oledjiks
Copy link
Author

Tell me please, maybe there are some working examples under android to connect with wamp-cra?

@oberstet
Copy link
Contributor

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 ..

@oledjiks
Copy link
Author

oledjiks commented Oct 18, 2019 via email

@oberstet oberstet changed the title Problem in authorization wampcra method (ChallengeResponseAuth) run authentication example as part of CI Oct 18, 2019
@oberstet
Copy link
Contributor

@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

@om26er
Copy link
Contributor

om26er commented Oct 18, 2019

Works for me, here is the code that I used in android to test

    private void testAuth() {
        exampleCRA("ws://192.168.1.236:8080/ws", "realm1", "joe", "secret2");
    }

    private static CompletableFuture<ExitInfo> connect(
            String websocketURL, String realm, IAuthenticator authenticator) {
        Session wampSession = new Session();
        wampSession.addOnJoinListener((session, details) -> System.out.println("Joined session."));
        Client client = new Client(wampSession, websocketURL, realm, authenticator);
        return client.connect();
    }

    public static CompletableFuture<ExitInfo> exampleCRA(
            String websocketURL, String realm, String authid, String secret) {
        return connect(websocketURL, realm, new ChallengeResponseAuth(authid, secret));
    }

And here is the config

{
    "$schema": "https://raw.githubusercontent.com/crossbario/crossbar/master/crossbar.json",
    "version": 2,
    "controller": {
    },
    "workers": [
        {
            "type": "router",
            "realms": [
                {
                    "name": "realm1",
                    "roles": [
                        {
                            "name": "frontend",
                            "permissions": [
                                {
                                    "uri": "",
                                    "match": "prefix",
                                    "allow": {
                                        "call": true,
                                        "register": true,
                                        "publish": true,
                                        "subscribe": true
                                    },
                                    "disclose": {
                                        "caller": false,
                                        "publisher": false
                                    },
                                    "cache": true
                                }
                            ]
                        }
                    ]
                }
            ],
            "transports": [
                {
                    "type": "web",
                    "endpoint": {
                        "type": "tcp",
                        "port": 8080
                    },
                    "paths": {
                        "ws": {
                            "type": "websocket",
                            "auth": {
                                "wampcra": {
                                    "type": "static",
                                    "users": {
                                        "joe": {
                                            "secret": "secret2",
                                            "role": "frontend"
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            ]
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants