Examples of Signer


Examples of org.keyczar.Signer

    @Override
    public Signer buildSigner(String key) {
        try {
            KeyczarReader child = keyczarFactory.getReader(key);
            return new Signer(child);
        } catch (KeyczarException e) {
            throw new IllegalStateException("Error building signer", e);
        }
    }
View Full Code Here

Examples of restx.security.Signer

    }

    public HttpTestClient authenticatedAs(String principal) {
        Factory factory = Factory.newInstance();
        RestxSessionCookieDescriptor restxSessionCookieDescriptor = factory.getComponent(RestxSessionCookieDescriptor.class);
        Signer signer = factory.queryByClass(Signer.class).findOneAsComponent().get();

        ImmutableMap.Builder<String, String> cookiesBuilder = ImmutableMap.<String, String>builder().putAll(cookies);
        String uuid = factory.getComponent(UUIDGenerator.class).doGenerate();
        String expires = DateTime.now().plusHours(1).toString();
        String sessionContent = String.format(
                "{\"_expires\":\"%s\",\"principal\":\"%s\",\"sessionKey\":\"%s\"}", expires, principal, uuid);
        cookiesBuilder.put(restxSessionCookieDescriptor.getCookieName(), sessionContent);
        cookiesBuilder.put(restxSessionCookieDescriptor.getCookieSignatureName(), signer.sign(sessionContent));

        return new HttpTestClient(baseUrl, principal, cookiesBuilder.build());
    }
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.