Package org.jclouds.oauth.v2.domain

Examples of org.jclouds.oauth.v2.domain.Header


      assertTrue(properties != null, "properties were not set");
      String signatureAlgorithm = getMandatoryProperty(properties, SIGNATURE_OR_MAC_ALGORITHM);
      checkState(OAuthConstants.OAUTH_ALGORITHM_NAMES_TO_SIGNATURE_ALGORITHM_NAMES.containsKey(signatureAlgorithm)
              , String.format("Algorithm not supported: " + signatureAlgorithm));

      Header header = Header.builder().signerAlgorithm(signatureAlgorithm).type("JWT").build();

      String scopes = getMandatoryProperty(properties, SCOPES);
      String audience = getMandatoryProperty(properties, AUDIENCE);

      long now = nowInSeconds();
View Full Code Here


      String audience = checkNotNull(propFunction.apply(AUDIENCE), AUDIENCE);

      // obtain the scopes from the subclass
      String scopes = getScopes();

      Header header = Header.builder().signerAlgorithm(signatureAlgorithm).type("JWT").build();

      long now = SECONDS.convert(System.currentTimeMillis(), MILLISECONDS);

      ClaimSet claimSet = ClaimSet.builder()
                                  .addClaim("aud", audience)
View Full Code Here

      String audience = checkNotNull(propFunction.apply(AUDIENCE), AUDIENCE);

      // obtain the scopes from the subclass
      String scopes = getScopes();

      Header header = Header.builder().signerAlgorithm(signatureAlgorithm).type("JWT").build();

      long now = SECONDS.convert(Ticker.systemTicker().read(), NANOSECONDS);

      ClaimSet claimSet = ClaimSet.builder()
                                  .addClaim("aud", audience)
View Full Code Here

      assertTrue(properties != null, "properties were not set");
      String signatureAlgorithm = getMandatoryProperty(properties, SIGNATURE_OR_MAC_ALGORITHM);
      checkState(OAuthConstants.OAUTH_ALGORITHM_NAMES_TO_SIGNATURE_ALGORITHM_NAMES.containsKey(signatureAlgorithm)
              , String.format("Algorithm not supported: " + signatureAlgorithm));

      Header header = Header.builder().signerAlgorithm(signatureAlgorithm).type("JWT").build();

      String scopes = getMandatoryProperty(properties, SCOPES);
      String audience = getMandatoryProperty(properties, AUDIENCE);

      long now = nowInSeconds();
View Full Code Here

   @Override
   public TokenRequest apply(GeneratedHttpRequest request) {
      long now = timeSourceMillisSinceEpoch.get() / 1000;

      // fetch the token
      Header header = new Header.Builder()
              .signerAlgorithm(signatureAlgorithm)
              .type(tokenRequestFormat.getTypeName())
              .build();

      ClaimSet claimSet = new ClaimSet.Builder(this.tokenRequestFormat.requiredClaims())
View Full Code Here

   public void testPayloadIsUrlSafe() throws IOException {

      TokenRequestFormat tokenRequestFormat = ContextBuilder.newBuilder(new OAuthApiMetadata()).overrides
              (OAuthTestUtils.defaultProperties(null)).build().utils()
              .injector().getInstance(TokenRequestFormat.class);
      Header header = new Header.Builder().signerAlgorithm("a").type("b").build();
      ClaimSet claimSet = new ClaimSet.Builder().addClaim("ist", STRING_THAT_GENERATES_URL_UNSAFE_BASE64_ENCODING)
              .build();
      TokenRequest tokenRequest = new TokenRequest.Builder().claimSet(claimSet).header(header).build();
      HttpRequest request = tokenRequestFormat.formatRequest(HttpRequest.builder().method("GET").endpoint
              ("http://localhost").build(), tokenRequest);
View Full Code Here

      String audience = checkNotNull(propFunction.apply(AUDIENCE), AUDIENCE);

      // obtain the scopes from the subclass
      String scopes = getScopes();

      Header header = Header.builder().signerAlgorithm(signatureAlgorithm).type("JWT").build();

      long now = SECONDS.convert(System.currentTimeMillis(), MILLISECONDS);

      ClaimSet claimSet = ClaimSet.builder()
                                  .addClaim("aud", audience)
View Full Code Here

   }


   public void testLoadPKString() throws IOException, NoSuchAlgorithmException, KeyStoreException,
           CertificateException, UnrecoverableKeyException, InvalidKeySpecException {
      OAuthCredentials creds = loadOAuthCredentials();
      assertNotNull(creds);
      assertEquals(creds.identity, "foo");
      assertNotNull(creds.privateKey);
   }
View Full Code Here

   }


   public void testLoadPKString() throws IOException, NoSuchAlgorithmException, KeyStoreException,
           CertificateException, UnrecoverableKeyException, InvalidKeySpecException {
      OAuthCredentials creds = loadOAuthCredentials();
      assertNotNull(creds);
      assertEquals(creds.identity, "foo");
      assertNotNull(creds.privateKey);
   }
View Full Code Here

   @Override
   public HttpRequest filter(HttpRequest request) throws HttpException {
      checkState(request instanceof GeneratedHttpRequest, "request must be an instance of GeneratedHttpRequest");
      GeneratedHttpRequest generatedHttpRequest = GeneratedHttpRequest.class.cast(request);
      TokenRequest tokenRequest = tokenRequestBuilder.apply(generatedHttpRequest);
      Token token = tokenFetcher.apply(tokenRequest);
      return request.toBuilder().addHeader("Authorization", String.format("%s %s",
              token.getTokenType(), token.getAccessToken())).build();

   }
View Full Code Here

TOP

Related Classes of org.jclouds.oauth.v2.domain.Header

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.