@Test public void shouldAddBearerToken() { request = MockRequestBuilder.create() .withContent(new ByteArrayInputStream("{\"TableName\": \"foo\"}".getBytes())) .withHeader("Host", "demo.us-east-1.amazonaws.com") .withHeader("x-amz-archive-description", "test test") .withPath("/") .withEndpoint("http: TokenProvider tokenProvider = new TokenProviderUtil(); AWSCredentialsProvider testCredProvider = new CredentialProviderUtil(tokenProvider); IBMOAuthSigner signer = new IBMOAuthSigner(); signer.sign(request, testCredProvider.getCredentials()); assertEquals("Bearer ProviderAccessToken", request.getHeaders().get("Authorization")); }
@Override public void sign(SignableRequest<?> request, AWSCredentials credentials) { log.debug("++ OAuth signer"); IBMOAuthCredentials oAuthCreds = (IBMOAuthCredentials)credentials; if (oAuthCreds.getTokenManager() instanceof DefaultTokenManager) { DefaultTokenManager tokenManager = (DefaultTokenManager)oAuthCreds.getTokenManager(); tokenManager.setClientConfiguration(clientConfiguration); request.addHeader( AUTHORIZATION,"Bearer " + tokenManager.getToken()); } else { request.addHeader( AUTHORIZATION,"Bearer " + oAuthCreds.getTokenManager().getToken()); } }
IBMOAuthSigner extends AbstractAWSSigner { @Override public void sign(SignableRequest<?> request, AWSCredentials credentials) { log.debug("++ OAuth signer"); IBMOAuthCredentials oAuthCreds = (IBMOAuthCredentials)credentials; if (oAuthCreds.getTokenManager() instanceof DefaultTokenManager) { DefaultTokenManager tokenManager = (DefaultTokenManager)oAuthCreds.getTokenManager(); tokenManager.setClientConfiguration(clientConfiguration); request.addHeader( AUTHORIZATION,"Bearer " + tokenManager.getToken()); } else { request.addHeader( AUTHORIZATION,"Bearer " + oAuthCreds.getTokenManager().getToken()); } } }
IBMOAuthSigner extends AbstractAWSSigner { @Override public void sign(SignableRequest<?> request, AWSCredentials credentials) { log.debug("++ OAuth signer"); IBMOAuthCredentials oAuthCreds = (IBMOAuthCredentials)credentials; if (oAuthCreds.getTokenManager() instanceof DefaultTokenManager) { DefaultTokenManager tokenManager = (DefaultTokenManager)oAuthCreds.getTokenManager(); tokenManager.setClientConfiguration(clientConfiguration); request.addHeader( AUTHORIZATION,"Bearer " + tokenManager.getToken()); } else { request.addHeader( AUTHORIZATION,"Bearer " + oAuthCreds.getTokenManager().getToken()); } } IBMOAuthSigner(ClientConfiguration clientConfiguration);  IBMOAuthSigner(); }
IBMOAuthSigner extends AbstractAWSSigner { @Override public void sign(SignableRequest<?> request, AWSCredentials credentials) { log.debug("++ OAuth signer"); IBMOAuthCredentials oAuthCreds = (IBMOAuthCredentials)credentials; if (oAuthCreds.getTokenManager() instanceof DefaultTokenManager) { DefaultTokenManager tokenManager = (DefaultTokenManager)oAuthCreds.getTokenManager(); tokenManager.setClientConfiguration(clientConfiguration); request.addHeader( AUTHORIZATION,"Bearer " + tokenManager.getToken()); } else { request.addHeader( AUTHORIZATION,"Bearer " + oAuthCreds.getTokenManager().getToken()); } } IBMOAuthSigner(ClientConfiguration clientConfiguration);  IBMOAuthSigner(); @Override void sign(SignableRequest<?> request, AWSCredentials credentials); }
IBMOAuthSigner extends AbstractAWSSigner { @Override public void sign(SignableRequest<?> request, AWSCredentials credentials) { log.debug("++ OAuth signer"); IBMOAuthCredentials oAuthCreds = (IBMOAuthCredentials)credentials; if (oAuthCreds.getTokenManager() instanceof DefaultTokenManager) { DefaultTokenManager tokenManager = (DefaultTokenManager)oAuthCreds.getTokenManager(); tokenManager.setClientConfiguration(clientConfiguration); request.addHeader( AUTHORIZATION,"Bearer " + tokenManager.getToken()); } else { request.addHeader( AUTHORIZATION,"Bearer " + oAuthCreds.getTokenManager().getToken()); } } IBMOAuthSigner(ClientConfiguration clientConfiguration);  IBMOAuthSigner(); @Override void sign(SignableRequest<?> request, AWSCredentials credentials);  }