Package org.jclouds.oauth.v2.functions

Examples of org.jclouds.oauth.v2.functions.SignOrProduceMacForToken$SignatureGenerator


   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testGSEChildExceptionsPropagateAsAuthorizationException() {
      OAuthCredentialsSupplier supplier = new OAuthCredentialsSupplier(Suppliers.ofInstance(new Credentials("MOMMA",
              "MIA")), new OAuthCredentialsForCredentials("MOMMA"), "MOMMA");
      supplier.get();
   }
View Full Code Here


   public void testCredentialsAreLoadedOnRightAlgoAndCredentials() {
      Properties propertied = OAuthTestUtils.defaultProperties(new Properties());
      Credentials validCredentials = new Credentials(propertied.getProperty("oauth.identity"),
              propertied.getProperty("oauth.credential"));
      OAuthCredentialsSupplier supplier = new OAuthCredentialsSupplier(Suppliers.ofInstance(validCredentials),
              new OAuthCredentialsForCredentials("RS256"), "RS256");
      assertNotNull(supplier.get());
   }
View Full Code Here

public class OAuthCredentialsFromPKTest {

   public static OAuthCredentials loadOAuthCredentials() throws IOException, NoSuchAlgorithmException,
         CertificateException, InvalidKeySpecException {
      OAuthCredentialsSupplier loader = new OAuthCredentialsSupplier(ofInstance(new Credentials("foo",
            toStringAndClose(new FileInputStream("src/test/resources/testpk.pem")))), new OAuthCredentialsForCredentials("RS256"), "RS256");
      return loader.get();
   }
View Full Code Here

   public static OAuthCredentials loadOAuthCredentials() throws IOException, NoSuchAlgorithmException,
         CertificateException, InvalidKeySpecException {
      OAuthCredentialsSupplier loader = new OAuthCredentialsSupplier(ofInstance(new Credentials("foo",
            Files.asCharSource(new File("src/test/resources/testpk.pem"), Charsets.UTF_8).read())),
            new OAuthCredentialsForCredentials("RS256"), "RS256");
      return loader.get();
   }
View Full Code Here

public class OAuthCredentialsSupplierTest {

   @Test(expectedExceptions = AuthorizationException.class)
   public void testAuthorizationExceptionIsThrownOnBadKeys() {
      OAuthCredentialsSupplier supplier = new OAuthCredentialsSupplier(Suppliers.ofInstance(new Credentials("MOMMA",
              "MIA")), new OAuthCredentialsForCredentials("RS256"), "RS256");
      supplier.get();
   }
View Full Code Here

   }

   @Test(expectedExceptions = IllegalArgumentException.class)
   public void testGSEChildExceptionsPropagateAsAuthorizationException() {
      OAuthCredentialsSupplier supplier = new OAuthCredentialsSupplier(Suppliers.ofInstance(new Credentials("MOMMA",
              "MIA")), new OAuthCredentialsForCredentials("MOMMA"), "MOMMA");
      supplier.get();
   }
View Full Code Here

   public void testCredentialsAreLoadedOnRightAlgoAndCredentials() {
      Properties propertied = OAuthTestUtils.defaultProperties(new Properties());
      Credentials validCredentials = new Credentials(propertied.getProperty("oauth.identity"),
              propertied.getProperty("oauth.credential"));
      OAuthCredentialsSupplier supplier = new OAuthCredentialsSupplier(Suppliers.ofInstance(validCredentials),
              new OAuthCredentialsForCredentials("RS256"), "RS256");
      assertNotNull(supplier.get());
   }
View Full Code Here

   public Map<Type, Object> provideCustomAdapterBindings() {
      return new ImmutableMap.Builder<Type, Object>()
              .put(Metadata.class, new MetadataTypeAdapter())
              .put(Operation.class, new OperationTypeAdapter())
              .put(Header.class, new HeaderTypeAdapter())
              .put(ClaimSet.class, new ClaimSetTypeAdapter())
              .put(Project.class, new ProjectTypeAdapter())
              .put(Instance.class, new InstanceTypeAdapter())
              .put(InstanceTemplate.class, new InstanceTemplateTypeAdapter())
              .put(FirewallOptions.class, new FirewallOptionsTypeAdapter())
              .put(Rule.class, new RuleTypeAdapter())
View Full Code Here

   @Override
   protected void configure() {
      bind(new TypeLiteral<Function<byte[], byte[]>>() {}).to(SignOrProduceMacForToken.class);
      bind(new TypeLiteral<Map<Type, Object>>() {}).toInstance(ImmutableMap.<Type, Object>of(
              Header.class, new HeaderTypeAdapter(),
              ClaimSet.class, new ClaimSetTypeAdapter()));
      bind(new TypeLiteral<Supplier<OAuthCredentials>>() {}).to(OAuthCredentialsSupplier.class);
      bind(new TypeLiteral<Function<GeneratedHttpRequest, TokenRequest>>() {}).to(BuildTokenRequest.class);
      bind(new TypeLiteral<Function<TokenRequest, Token>>() {}).to(FetchToken.class);
   }
View Full Code Here

   public Map<Type, Object> provideCustomAdapterBindings() {
      return new ImmutableMap.Builder<Type, Object>()
              .put(Metadata.class, new MetadataTypeAdapter())
              .put(Operation.class, new OperationTypeAdapter())
              .put(Header.class, new HeaderTypeAdapter())
              .put(ClaimSet.class, new ClaimSetTypeAdapter())
              .put(Project.class, new ProjectTypeAdapter())
              .put(Instance.class, new InstanceTypeAdapter())
              .put(InstanceTemplate.class, new InstanceTemplateTypeAdapter())
              .put(FirewallOptions.class, new FirewallOptionsTypeAdapter())
              .put(RouteOptions.class, new RouteOptionsTypeAdapter())
View Full Code Here

TOP

Related Classes of org.jclouds.oauth.v2.functions.SignOrProduceMacForToken$SignatureGenerator

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.