Package org.jboss.aerogear.test

Examples of org.jboss.aerogear.test.Session


    public Session login() {

        URI authServerEndpointUri = KeycloakUriBuilder.fromUri(getAuthServerUrl().toExternalForm())
                .path(ServiceUrlConstants.TOKEN_SERVICE_DIRECT_GRANT_PATH).build("aerogear");

        Session session = Session.newSession(authServerEndpointUri.toString());
        // FIXME dont use Session here! Fire up our own RestAssured
        Response response = session.given()
                .header(Headers.acceptJson())
                .formParam("username", username)
                .formParam("password", password)
                .formParam(OAuth2Constants.CLIENT_ID, "integration-tests")
                .post();

        if(response.statusCode() == HttpStatus.SC_OK) {
            try {
                AccessTokenResponse tokenResponse =
                        JsonSerialization.readValue(response.asString(), AccessTokenResponse.class);

                return new Session(getUnifiedPushServerUrl(), tokenResponse);
                // FIXME handle the possible io exception!
            } catch (IOException e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            }
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.test.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.