nacx commented on this pull request.
> @@ -63,6 +64,17 @@ protected final String guiceProvideTimeStamp(@TimeStamp
> Supplier<String> cache)
protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
return cache.get();
}
+
+ /**
+ * checks which Authentication type is used
+ *
+ */
+ @Named("sasAuth")
+ @Provides
+ protected Boolean authSAS(@org.jclouds.location.Provider
Supplier<Credentials> creds) {
+ String credential = creds.get().credential;
+ return credential.matches("sv.*se.*sig.*");
If that is a query map it may be better and easier to parse it and just check
for the presence of all mandatory keys. Something like:
```java
import static com.google.common.base.Predicates.in;
import static com.google.common.base.Predicates.not;
import static com.google.common.collect.Iterables.all;
@Named("sasAuth")
@Provides
protected Boolean authSAS(@org.jclouds.location.Provider Supplier<Credentials>
creds) {
String credential = creds.get().credential;
List<String> required = ImmutableList.of("sv", "se", "st", "sig", "sp");
try {
Map<String, String> tokens =
Splitter.on('&').withKeyValueSeparator('=').split(credential);
return all(required, in(tokens.keySet()));
} catch (Exception ex) {
return false;
}
}
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1270#discussion_r256334486