Examples of AuthenticationClient


Examples of co.cask.cdap.security.authentication.client.AuthenticationClient

    this.verifySSLCert = Boolean.valueOf(System.getProperty(PROP_VERIFY_SSL_CERT, "true"));
    this.hostname = Objects.firstNonNull(hostname, "localhost");
    this.port = DEFAULT_PORT;
    this.uri = URI.create(String.format("http://%s:%d", hostname, port));
    this.sslPort = DEFAULT_SSL_PORT;
    AuthenticationClient authenticationClient = new BasicAuthenticationClient();
    authenticationClient.setConnectionInfo(hostname, port, DEFAULT_SSL);
    this.clientConfig = new ClientConfig(hostname, port,
                                         new HttpRequestConfig(15000, 15000, verifySSLCert),
                                         new HttpRequestConfig(0, 0, verifySSLCert),
                                         authenticationClient);
    this.version = tryGetVersion();
View Full Code Here

Examples of co.cask.cdap.security.authentication.client.AuthenticationClient

    if (!SocketUtil.isAvailable(hostname, port)) {
      throw new IOException(String.format("Host %s on port %d could not be reached", hostname, port));
    }

    AuthenticationClient authenticationClient = new BasicAuthenticationClient();
    authenticationClient.setConnectionInfo(hostname, port, ssl);
    Properties properties = new Properties();
    properties.put(BasicAuthenticationClient.VERIFY_SSL_CERT_PROP_NAME, String.valueOf(cliConfig.isVerifySSLCert()));

    if (authenticationClient.isAuthEnabled()) {
      output.printf("Authentication is enabled in the gateway server: %s.\n", hostname);
      ConsoleReader reader = new ConsoleReader();
      for (Credential credential : authenticationClient.getRequiredCredentials()) {
        String prompt = "Please, specify " + credential.getDescription() + "> ";
        String credentialValue;
        if (credential.isSecret()) {
          credentialValue = reader.readLine(prompt, '*');
        } else {
          credentialValue = reader.readLine(prompt);
        }
        properties.put(credential.getName(), credentialValue);
      }
      authenticationClient.configure(properties);
      cliConfig.getClientConfig().setAuthenticationClient(authenticationClient);
      authenticationClient.getAccessToken();
    }

    cliConfig.setConnection(hostname, port, ssl);
    output.printf("Successfully connected CDAP instance at %s:%d\n", hostname, port);
  }
View Full Code Here

Examples of org.wso2.carbon.cloud.csg.agent.client.AuthenticationClient

     * @throws RemoteException throws in case of a connection failure
     */
    public static String getSessionCookie(String serverUrl, String userName, String password,
                                          String domainName, String hostName) throws
            SocketException, RemoteException, LoginAuthenticationExceptionException {
        AuthenticationClient authClient = new AuthenticationClient();
        return authClient.getSessionCookie(serverUrl, userName, password, hostName, domainName);
    }
View Full Code Here

Examples of org.wso2.carbon.cloud.csg.agent.client.AuthenticationClient

            String domainName = csgServer.getDomainName();

            // authenticate using provided credentials and if logged in persist them
            String authServerUrl = "https://" + hostName + ":" + csgServer.getPort() +
                    "/services/AuthenticationAdmin";
            AuthenticationClient authClient = new AuthenticationClient();
            authClient.getLoggedAuthAdminStub(
                    authServerUrl, userName, passWord, hostName, domainName);

            org.wso2.carbon.registry.core.Registry registry = getConfigSystemRegistry();
            CSGAgentUtils.persistServer(registry, csgServer);
        } catch (Exception e) {
View Full Code Here

Examples of org.wso2.carbon.event.client.AuthenticationClient

            //urlContext contains "/" as a prefix (e.g. /wsas)
            String urlContext = urlPath.substring(0, urlPath.indexOf("/services/"));
            String authAdminUrl = "https://" + url.getHost() + ":" + url.getPort()  /* "https://localhost:9443" */
                    + urlContext + "/services/AuthenticationAdmin";                 /* "/wsas/services/AuthenticationAdmin" */

            AuthenticationClient authenticationClient = new AuthenticationClient(configurationContext, authAdminUrl);

            if (authenticationClient.authenticate(userName, password)) {
                this.cookie = authenticationClient.getSessionCookie();
            } else {
                throw new AuthenticationExceptionException("authentication Fault");
            }
        } catch (RemoteException e) {
            throw AxisFault.makeFault(e);
View Full Code Here

Examples of unibg.overencrypt.client.AuthenticationClient

        String path = options.nonOptionArguments().get(1);
        logger.debug(path);

        OverEncryptClient client = new OverEncryptClient();
        AuthenticationClient pinManagementClient = new AuthenticationClient();
        PermissionsClient permissionsClient = new PermissionsClient();

        Response resp = client.readResponse(path);
        logger.debug("Response:\n===\n" + resp.toString() + "===");

        if (resp.getPrimitive() == ServerPrimitives.OE_DHKEYPAIRS) {
            exitWithError(1, "The user hasn't chosen a passphrase yet. "
                    + "Use the '" + new GenerateKeysCommand().getKeyword()
                    + "' command to choose one.");
        }

        String userId = resp.getValue("userId");
        String passphrase = "";

        if (options.has("p") || options.has("passphrase")) {
            passphrase = (String) options.valueOf("p");
        } else {
            exitWithError(2, "No passphrase supplied. Please use " +
                    "the -p/--passphrase option to supply a valid passphrase.");
        }

        client.deleteResponse(path);
        while (resp.getPrimitive() == ServerPrimitives.OE_AUTHENTICATION) {
            resp = pinManagementClient.checkPin(path, userId, passphrase);
            logger.debug("Response:\n===\n" + resp.toString() + "===");
        }

        if (resp.getPrimitive() == ServerPrimitives.OE_UPDATE_ALL_PERMS) {
            permissionsClient.updateAllPermissions(resp.getValue("friends"),
View Full Code Here

Examples of unibg.overencrypt.client.AuthenticationClient

            exitWithError("No passphrase supplied. Please use "
                    + "the -p/--passphrase option to supply a valid passphrase.");
        }

        OverEncryptClient client = new OverEncryptClient();
        AuthenticationClient pinManagementClient = new AuthenticationClient();

        Response resp = client.waitForResponse(path);
        String userId = resp.getValue("userId");
        logger.debug("Response:\n===\n" + resp.toString() + "===");

        if (resp.getPrimitive() == ServerPrimitives.OE_DHKEYPAIRS) {
            resp = pinManagementClient.generateKeyPairs(path, userId,
                    passphrase);
            logger.debug("Response:\n===\n" + resp.toString() + "===");

            if (resp.getPrimitive() == ServerPrimitives.OE_SUCCESSFUL) {
                exitWithSuccess("Keys generated successfully.");
View Full Code Here

Examples of unibg.overencrypt.client.AuthenticationClient

    @Override
    public void run(String[] args) {
        OptionSet options = new OptionParser().parse(args);
        String path = options.nonOptionArguments().get(1);

        Response response = new AuthenticationClient().logout(path);

        if (response.getPrimitive() == ServerPrimitives.OE_SUCCESSFUL) {
            exitWithSuccess("Logout successful. You can now unmount your "
                    + "WebDAV client.");
        } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.