Examples of NonceHistory


Examples of org.apache.cxf.rs.security.oauth2.tokens.mac.NonceHistory

    @Test
    public void testVerifyNonce() {
        long now = System.currentTimeMillis();
        Nonce nonce1 = new Nonce("nonce1", now - 2000); // first request 2 seconds back
        Nonce nonce2 = new Nonce("nonce2", now - 1000); // second request 1 second back
        NonceHistory nonceHistory = new NonceHistory(200, nonce1); // first request time delta is 200ms
        nonceHistory.addNonce(nonce2);

        EasyMock.expect(nonceStore.getNonceHistory("testTokenKey")).andReturn(nonceHistory);
        EasyMock.replay(nonceStore);
        nonceVerifier.setAllowedWindow(2000); // allowed window is 2 seconds
        nonceVerifier.verifyNonce("testTokenKey", "nonce3", Long.toString(now - 500));
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth2.tokens.mac.NonceHistory

    @Test
    public void testVerifyNonceDuplicateNonce() {
        long now = System.currentTimeMillis();
        Nonce nonce1 = new Nonce("nonce1", now - 2000); // first request 2 seconds back
        Nonce nonce2 = new Nonce("nonce2", now - 1000); // second request 1 second back
        NonceHistory nonceHistory = new NonceHistory(200, nonce1); // first request time delta is 200ms
        nonceHistory.addNonce(nonce2);

        EasyMock.expect(nonceStore.getNonceHistory("testTokenKey")).andReturn(nonceHistory);
        EasyMock.replay(nonceStore);
        nonceVerifier.setAllowedWindow(2000); // allowed window is 2 seconds
        try {
View Full Code Here

Examples of org.apache.cxf.rs.security.oauth2.tokens.mac.NonceHistory

    @Test
    public void testVerifyNonceInvalidTimestamp() {
        long now = System.currentTimeMillis();
        Nonce nonce1 = new Nonce("nonce1", now - 2000); // first request 2 seconds back
        Nonce nonce2 = new Nonce("nonce2", now - 1000); // second request 1 second back
        NonceHistory nonceHistory = new NonceHistory(200, nonce1); // first request time delta is 200ms
        nonceHistory.addNonce(nonce2);

        EasyMock.expect(nonceStore.getNonceHistory("testTokenKey")).andReturn(nonceHistory);
        EasyMock.replay(nonceStore);
        nonceVerifier.setAllowedWindow(2000); // allowed window is 2 seconds
        try {
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.