Examples of OAuthSignatureMethodFactory


Examples of org.springframework.security.oauth.common.signature.OAuthSignatureMethodFactory

      protected String getSignatureBaseString(Map<String, Set<CharSequence>> oauthParams, URL requestURL,
          String httpMethod) {
        return "MYSIGBASESTRING";
      }
    };
    OAuthSignatureMethodFactory sigFactory = mock(OAuthSignatureMethodFactory.class);
    support.setSignatureFactory(sigFactory);
    OAuthConsumerToken token = new OAuthConsumerToken();
    OAuthSignatureMethod sigMethod = mock(OAuthSignatureMethod.class);

    when(details.getConsumerKey()).thenReturn("my-consumer-key");
    when(details.getSignatureMethod()).thenReturn(HMAC_SHA1SignatureMethod.SIGNATURE_NAME);
    when(details.getSignatureMethod()).thenReturn(HMAC_SHA1SignatureMethod.SIGNATURE_NAME);
    SharedConsumerSecret secret = new SharedConsumerSecretImpl("shh!!!");
    when(details.getSharedSecret()).thenReturn(secret);
    when(sigFactory.getSignatureMethod(HMAC_SHA1SignatureMethod.SIGNATURE_NAME, secret, null))
        .thenReturn(sigMethod);
    when(sigMethod.sign("MYSIGBASESTRING")).thenReturn("MYSIGNATURE");

    Map<String, Set<CharSequence>> params = support.loadOAuthParameters(details, url, token, "POST", null);
    assertEquals("some", params.remove("with").iterator().next().toString());
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.