Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make SharedAccessSignatureTokenProvider capable of handing updated creds #56

Open
dlstucki opened this issue Nov 5, 2019 · 1 comment

Comments

@dlstucki
Copy link
Contributor

dlstucki commented Nov 5, 2019

(New issue based on point 4 in issue #55.)

Consider making SharedAccessSignatureTokenProvider allow updating the credentials. Something similar to this pseudo-code:

public class SharedAccessSignatureTokenProvider extends TokenProvider {

    ... 

    public void set_sharedAccessSignature(String value) { }
    public void set_keyName(String value) { }
    public void set_sharedAccessKey(String value) { }
@dlstucki
Copy link
Contributor Author

dlstucki commented Nov 5, 2019

In the meantime here is a work-around:
#55 (comment)
write a class extending TokenProvider that allows changing the key-name+key_value or a signature itself.
Pseudo-code

public class UpdatableSharedAccessSignatureTokenProvider extends TokenProvider {

	// When the credentials change replace this object:  
	private /*SharedAccessSignature*/TokenProvider innerSasTokenProvider;

	. . . 

	public void updateCredentials(String keyName, String keyValue) {
		this.innerSasTokenProvider = TokenProvider.createSharedAccessSignatureTokenProvider(keyName, keyValue);
	}
	public void updateCredentials(String signature) {
		this.innerSasTokenProvider = TokenProvider.createSharedAccessSignatureTokenProvider(signature);
	}

	@Override
	protected CompletableFuture<SecurityToken> onGetTokenAsync(String resource, Duration validFor) {
		return this.innerSasTokenProvider.GetTokenAsync(resource, duration);
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant