Package unibg.overencrypt.client

Examples of unibg.overencrypt.client.PermissionsClient


        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"),
                    resp.getValue("userInfos"), resp.getValue("friendsInfos"),
                    path, userId, passphrase);

            exitWithSuccess("User authenticated successfully.");
        } else {
View Full Code Here

TOP

Related Classes of unibg.overencrypt.client.PermissionsClient

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.