Re: [jclouds/jclouds] Token based authentication in openstack-keystone (#433)

2017-10-01 Thread pimenas
@pimenas pushed 1 commit. a9a9d30 Merge remote-tracking branch 'jclouds/master' into new/openstack-token-based-auth -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/jclouds/jclouds/pull

Re: [jclouds/jclouds] Token based authentication in openstack-keystone (#433)

2017-09-28 Thread pimenas
@gaul I'll check it during the weekend! -- 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/433#issuecomment-332757167

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2015-03-25 Thread pimenas
I'll work on it. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/433#issuecomment-85900114

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-10-15 Thread pimenas
Did a rebase because it has been a long time and there were merge conflicts. Also @jdaggett you had a comment about ParseAccessTest that I had a question --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/433#issuecomment-59185690

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-09-10 Thread pimenas
Sorry for the delayed response, I did a rebase and implemented your feedback, except the ones that I don't yet understand :). One of the feedback I couldn't understand is @jdaggett 's suggestion to use ParseAccessTest, to which I commented the following: *... I can't find a way to get an Acces

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-09-10 Thread pimenas
> @@ -87,6 +87,41 @@ public HttpRequest > initialAuthWithAccessKeyAndSecretKeyAndTenantId(String access > accessKey, secretKey, > getTenantId()), "application/json")).build(); > } > > + public HttpRequest initialAuthWithTokenAndTenantName(

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-09-10 Thread pimenas
> @@ -31,6 +32,11 @@ public void testCredentialTypeOfWhenValid() { > "password")), CredentialTypes.PASSWORD_CREDENTIALS); > } > > + public void testCredentialTypeOfWhenValidToken() { > + > assertEquals(CredentialTypes.credentialTypeOf(TokenCredentials.createWithToken("

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-09-10 Thread pimenas
> + > +import com.google.common.base.Optional; > + > +@CredentialType(CredentialTypes.TOKEN_CREDENTIALS) > +@Singleton > +public class AuthenticateTokenCredentials extends > BaseAuthenticator { > + protected final AuthenticationApi api; > + > + @Inject > + public AuthenticateTokenCredentials

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-09-10 Thread pimenas
> @@ -32,6 +32,8 @@ > > public static final String PASSWORD_CREDENTIALS = "passwordCredentials"; > > + public static final String TOKEN_CREDENTIALS = "token"; In that case I should make changes to `BindAuthToJsonPayload` because this value is used to create the `token` JSONt field. Wh

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-09-10 Thread pimenas
> @@ -99,4 +100,33 @@ Access authenticateWithTenantNameAndCredentials(@Nullable > @PayloadParam("tenantN > @MapBinder(BindAuthToJsonPayload.class) > Access authenticateWithTenantIdAndCredentials(@Nullable > @PayloadParam("tenantId") String tenantId, > ApiAccessKeyCredentials api

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-08-30 Thread pimenas
> @@ -42,6 +42,18 @@ public void testGetApiMetaData() { >assertEquals(metadata, new ParseRackspaceApiMetadataTest().expected()); > } > > + public void testGetApiMetaDataWithTokenCredentialsAuth() { > + KeystoneApi api = requestsSendResponses( > +keystoneAuthWithToke

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-07-14 Thread pimenas
Should I close this? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/433#issuecomment-48984007

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-07-10 Thread pimenas
Hi @jdaggett . I had a quick look on the openstack-common, I wasn't aware of this. To tell you the truth I did not find how to use this authentication method with openstack-common, but I didn't gave it much time either. I'm working with version 2.0 (http://developer.openstack.org/api-ref-identit

Re: [jclouds] Token based authentication in openstack-keystone (#433)

2014-07-03 Thread pimenas
@jdaggett I updated the first comment with more information! --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/433#issuecomment-47954217

[jclouds] Support token based authentication in openstack-keystone (#433)

2014-07-03 Thread pimenas
This PR adds support for token based authentication in openstack-keystone. You can merge this Pull Request by running: git pull https://github.com/pimenas/jclouds new/openstack-token-based-auth Or you can view, comment on it, or merge it online at: https://github.com/jclouds/jclouds/pull

Re: [jclouds] openstack console (#339)

2014-07-02 Thread pimenas
:) You're all very welcome and thank you also!!! It's been a very learning experience for me. @everett-toews indeed its [me](https://twitter.com/pimenas) on twitter :) --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-47831452

Re: [jclouds] openstack console (#339)

2014-06-28 Thread pimenas
I did the rebase and also squashed the change to 1 commit, so it should be ready for merging! --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-47446294

Re: [jclouds] openstack console (#339)

2014-06-28 Thread pimenas
Actually I have one more thing to do, rebasing, never done this before so I have to read a little. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-47437937

Re: [jclouds] openstack console (#339)

2014-06-28 Thread pimenas
Hello! I've implemented all the suggestions, removed the expect style tests, and updated the MockWebStyle and live tests. I also merged with the latest master branch, so it's ready for merging! --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issu

Re: [jclouds] openstack console (#339)

2014-06-26 Thread pimenas
Hi! Sorry for the late response, but I couldn't find time... As @demobox pointed out we need * different implementation of fromValue(). Already done that, haven't pushed the changes yet. * use MockWebServer style tests instead of expect tests. I'll remove the expect tests and implement them usi

Re: [jclouds] openstack console (#339)

2014-06-03 Thread pimenas
> + } > + > + /** > + * Used from jclouds builtin deserializer. > + */ > + public static Type fromValue(String type) { > + if (type != null) { > + for (Type value : Type.values()) { > +if (type.equals(value.type)) { > +

Re: [jclouds] openstack console (#339)

2014-05-30 Thread pimenas
> + } > + > + /** > + * Used from jclouds builtin deserializer. > + */ > + public static Type fromValue(String type) { > + if (type != null) { > + for (Type value : Type.values()) { > +if (type.equals(value.type)) { > +

Re: [jclouds] openstack console (#339)

2014-05-29 Thread pimenas
> + > .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/"; > + + "servers/" + serverId + "/action") > + .build(); > + > + HttpResponse getConsoleResponse = > HttpResponse.builder().statusCode(200) > + .message("HTTP/1.1 200 OK") > +

Re: [jclouds] openstack console (#339)

2014-05-29 Thread pimenas
> + private final String type; > + > + Type(String type) { > + this.type = type; > + } > + > + public String type() { > + return type; > + } > + > + /** > + * Used from jclouds builtin deserializer. > + */ > + public static Type fromVal

Re: [jclouds] openstack console (#339)

2014-05-27 Thread pimenas
> + private final String type; > + > + Type(String type) { > + this.type = type; > + } > + > + public String type() { > + return type; > + } > + > + /** > + * Used from jclouds builtin deserializer. > + */ > + public static Type fromVal

Re: [jclouds] openstack console (#339)

2014-05-27 Thread pimenas
> + > + Console.Type type = (Console.Type) postParams.get("type"); > + > + switch (type) { > + case NOVNC: > + case XVPVNC: > +action = "os-getVNCConsole"; > +break; > + case SPICE_HTML5: > +action = "os-getSPICEConsole"; > +

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> + > .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/"; > + + "servers/" + serverId + "/action") > + .build(); > + > + HttpResponse getConsoleResponse = > HttpResponse.builder().statusCode(200) > + .message("HTTP/1.1 200 OK") > +

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> + > + private final String type; > + > + Type(String type) { > + this.type = type; > + } > + > + public String type() { > + return type; > + } > + > + /** > + * Used from jclouds builtin deserializer. > + */ > + public static Type fro

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> + > + Console.Type type = (Console.Type) postParams.get("type"); > + > + switch (type) { > + case NOVNC: > + case XVPVNC: > +action = "os-getVNCConsole"; > +break; > + case SPICE_HTML5: > +action = "os-getSPICEConsole"; > +

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
I plan to add tests for all types, after all they are tested in a similar way. The reason I haven't done it yet, is that I want you guys to review the test code (especialy the mockwebserver style tests) and tell me if I should change/add/remove something. --- Reply to this email directly or vie

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> +@Test(groups = "live", testName = "ConsolesApiLiveTest") > +public class ConsolesApiLiveTest extends BaseNovaApiLiveTest { > + > +@Test > +public void testGetVNCConsole() { > +for (String zoneId : api.getConfiguredZones()) { > +Optional apiOption = > api.getConsolesE

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> + */ > +@Test(groups = "live", testName = "ConsolesApiLiveTest") > +public class ConsolesApiLiveTest extends BaseNovaApiLiveTest { > + > +@Test > +public void testGetVNCConsole() { > +for (String zoneId : api.getConfiguredZones()) { > +Optional apiOption = > api.getCo

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> +@Test > +public void testGetVNCConsole() { > +for (String zoneId : api.getConfiguredZones()) { > +Optional apiOption = > api.getConsolesExtensionForZone(zoneId); > +if (!apiOption.isPresent()) > +continue; > + > +ConsolesApi ap

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> + > .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/"; > + + "servers/" + serverId + "/action") > + .build(); > + > + HttpResponse getConsoleResponse = > HttpResponse.builder().statusCode(200) > + .message("HTTP/1.1 200 OK") > +

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> +import org.jclouds.openstack.v2_0.ServiceType; > +import org.jclouds.openstack.v2_0.services.Extension; > + > +import com.google.common.annotations.Beta; > + > +/** > + * Provides synchronous access to Consoles. > + * > + * > + * @see ConsoleAsyncApi > + */ > +@Beta > +@Extension(of = ServiceTy

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> + private final String type; > + > + Type(String type) { > + this.type = type; > + } > + > + public String type() { > + return type; > + } > + > + /** > + * Used from jclouds builtin deserializer. > + */ > + public static Type fromVal

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> + > + private final String type; > + > + Type(String type) { > + this.type = type; > + } > + > + public String type() { > + return type; > + } > + > + /** > + * Used from jclouds builtin deserializer. > + */ > + public static Type fro

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> + switch (type) { > + case NOVNC: > + case XVPVNC: > +action = "os-getVNCConsole"; > +break; > + case SPICE_HTML5: > +action = "os-getSPICEConsole"; > +break; > + case RDP_HTML5: > +action = "os-getRD

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> +import org.jclouds.rest.binders.BindToJsonPayload; > + > +import com.google.common.collect.ImmutableMap; > +import com.google.common.collect.ImmutableSortedMap; > + > +@Singleton > +public class BindConsoleToJsonPayload extends BindToJsonPayload { > + > + @Inject > + public BindConsoleToJson

Re: [jclouds] openstack console (#339)

2014-05-26 Thread pimenas
> + > + Console.Type type = (Console.Type) postParams.get("type"); > + > + switch (type) { > + case NOVNC: > + case XVPVNC: > +action = "os-getVNCConsole"; > +break; > + case SPICE_HTML5: > +action = "os-getSPICEConsole"; > +

Re: [jclouds] openstack console (#339)

2014-05-24 Thread pimenas
I pushed the change in Console.Type enum suggested by @zack-shoylev in comments above. Any suggestions on the ConsolesApiMockTest.java, ConsolesApiLiveTest.java? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-44114247

Re: [jclouds] openstack console (#339)

2014-05-24 Thread pimenas
> + * Server Console Connection structure. > + * > + * @author Epi Vou > + * @see http://api.openstack.org/api-ref-compute-v2-ext.html"; /> > + */ > +public class Console { > + public enum Type { > + NOVNC("novnc"), > + XVPVNC("xvpvnc"), > + SPICE_HTML5("spice-html5"), > + RDP

Re: [jclouds] openstack console (#339)

2014-05-24 Thread pimenas
Is this a real failure? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-44089879

Re: [jclouds] openstack console (#339)

2014-05-24 Thread pimenas
> +@Extension(of = ServiceType.COMPUTE, namespace = > ExtensionNamespaces.CONSOLES) > +@RequestFilters(AuthenticateRequest.class) > +public interface ConsolesAsyncApi { > + /** > +* @see ConsolesApi#getConsole > +*/ > + @Named("server:console") > + @POST > + @Path("/servers/{server

Re: [jclouds] openstack console (#339)

2014-05-24 Thread pimenas
> + * Server Console Connection structure. > + * > + * @author Epi Vou > + * @see http://api.openstack.org/api-ref-compute-v2-ext.html"; /> > + */ > +public class Console { > + public enum Type { > + NOVNC("novnc"), > + XVPVNC("xvpvnc"), > + SPICE_HTML5("spice-html5"), > + RDP

Re: [jclouds] openstack console (#339)

2014-05-24 Thread pimenas
> + * > + * @author Epi Vou > + */ > +@Singleton > +public class BindConsoleToJsonPayload extends BindToJsonPayload { > + > + @Inject > + public BindConsoleToJsonPayload(Json jsonBinder) { > + super(jsonBinder); > + } > + > + @Override > + public R bindToRequest(R request, Map Obje

Re: [jclouds] openstack console (#339)

2014-05-01 Thread pimenas
Hi! I pushed the changes, I also added a mockstyle test, but I would like some feedback on this. many thanks for all the help so far! --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-41887119

Re: [jclouds] openstack console (#339)

2014-04-30 Thread pimenas
> + .addHeader("X-Auth-Token", authToken) > + .payload(payloadFromStringWithContentType( > + "{\"os-getVNCConsole\":{\"type\":\"novnc\"}}", > + "application/json")) > + > .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/34

Re: [jclouds] openstack console (#339)

2014-04-30 Thread pimenas
> + .addHeader("X-Auth-Token", authToken) > + .payload(payloadFromStringWithContentType( > + "{\"os-getVNCConsole\":{\"type\":\"novnc\"}}", > + "application/json")) > + > .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/34

Re: [jclouds] openstack console (#339)

2014-04-29 Thread pimenas
> + .addHeader("X-Auth-Token", authToken) > + .payload(payloadFromStringWithContentType( > + "{\"os-getVNCConsole\":{\"type\":\"novnc\"}}", > + "application/json")) > + > .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/34

Re: [jclouds] openstack console (#339)

2014-04-27 Thread pimenas
Hi all, I'm currently proceeding with the changes, and I stumbled upon the switching to one `getConsole()` function. In `ConsolesAsyncApi.java` the `@Payload` annotation needs an extra parameter, that is related to the console type parameter. Any ideas on how to pass the correct os-getVNCConso

Re: [jclouds] openstack console (#339)

2014-04-14 Thread pimenas
I'll proceed with the fixes, and I would also like to replace `getRDPConsole`, `getSPICEConsole` and `getRDPConsole` with a single `getConsole`. Any objections on that? --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-40431161

Re: [jclouds] openstack console (#339)

2014-04-14 Thread pimenas
> + > + /** > +* Get SPICE Console > +* @param serverId Server id > +* @param type Only "spice-html5" is supported > +* @return a Console object containing the console url and type. > +*/ > + Console getSPICEConsole(String serverId, Console.Type type); > + > + /** > +*

Re: [jclouds] openstack console (#339)

2014-04-14 Thread pimenas
> + } > + > + private final String type; > + > + Type(String type) { > + this.type = type; > + } > + > + public String type() { > + return type; > + } > + > + /** > + * Used from jclouds builtin deserializer. > + */ > + public stat

Re: [jclouds] openstack console (#339)

2014-04-14 Thread pimenas
> + * Server Console Connection structure. > + * > + * @author Epi Vou > + * @see http://api.openstack.org/api-ref-compute-v2-ext.html"; /> > + */ > +public class Console { > + public enum Type { > + NOVNC("novnc"), > + XVPVNC("xvpvnc"), > + SPICE_HTML5("spice-html5"), > + RDP

Re: [jclouds] openstack console (#339)

2014-04-13 Thread pimenas
Just uploaded my changes which include switching to URI for console url and enum for console type. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-40316074

Re: [jclouds] openstack console (#339)

2014-04-13 Thread pimenas
Thanks, that will work! Epimenidis Voutsakis Electronics & Computer Engineer pime...@gmail.com +30 695 720 6307 (Mobile, Greece) On Sun, Apr 13, 2014 at 3:40 PM, Ignasi Barrera wrote: > Jclouds already has a built-in enum deserializer. It will use the > valueOfmethod, but will fallback to a >

Re: [jclouds] openstack console (#339)

2014-04-13 Thread pimenas
Is there a simple way to provide a custom deserialization adapter for the underlying gson? I need this in order to change the console type field to an enum type field. --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-40304858

Re: [jclouds] openstack console (#339)

2014-04-13 Thread pimenas
Ok, I'll get on to it. In the mean-time you can all have a look of the how the code looks now. I decided to provide three different functions, in accordance with the openstack consoles api. These are getVNCConsole(), getSPICEConsole() and getRDPConsole(). --- Reply to this email directly or view

Re: [jclouds] openstack console (#339)

2014-04-12 Thread pimenas
Hi @jdaggett, @everett-toews! I'll make the changes and add a "live" test as well. A question that I have is if you think that the Console class, is good as it is, or if for example I should change the url to URI type, and make the type an enum. What do you think? Epimenidis Voutsakis Electroni

Re: [jclouds] openstack console (#339)

2014-04-07 Thread pimenas
Hi @demobox! It's my first attempt to contribute! --- Reply to this email directly or view it on GitHub: https://github.com/jclouds/jclouds/pull/339#issuecomment-39817198

Re: [jclouds] openstack console (#339)

2014-04-07 Thread pimenas
> + > + public void testGetConsoleWhenResponseIs404NotFound() throws Exception { > + String serverId = "d3aae414-9dc9-46d1-a51b-e9b7071a84b7"; > + String type = "novnc"; > + > + HttpRequest getConsole = HttpRequest > + .builder() > + .method("POST") > + .addHea

Re: [jclouds] openstack console (#339)

2014-04-07 Thread pimenas
> + > + public void testGetConsoleWhenResponseIs401NotAuthorized() throws > Exception { > + String serverId = "d3aae414-9dc9-46d1-a51b-e9b7071a84b7"; > + String type = "novnc"; > + > + HttpRequest getConsole = HttpRequest > + .builder() > + .method("POST") > +

Re: [jclouds] openstack console (#339)

2014-04-07 Thread pimenas
> + > + public void testGetConsoleWhenResponseIs2xx() throws Exception { > + String serverId = "123"; > + String type = "novnc"; > + > + HttpRequest getConsole = HttpRequest > + .builder() > + .method("POST") > + .addHeader("Accept", "application/json") > +

Re: [jclouds] openstack console (#339)

2014-04-07 Thread pimenas
> + */ > +public class ParseServerConsole implements Function { > + > +private final ParseJson>> parser; > + > +@Inject > +public ParseServerConsole(ParseJson>> > parser) { > +this.parser = parser; > +} > + > +@Override > +public Console apply(HttpResponse response)

Re: [jclouds] openstack console (#339)

2014-04-07 Thread pimenas
> +import java.beans.ConstructorProperties; > + > +import com.google.common.base.Objects; > +import com.google.common.base.Objects.ToStringHelper; > + > +import static com.google.common.base.Preconditions.checkNotNull; > + > +/** > + * Connection information to connect to a server using VNC. > + *

[jclouds] openstack console (#339)

2014-04-07 Thread pimenas
I've extended NovaApi.java and NovaAsyncApi.java to support method getConsole() which returns the vnc access url. You can merge this Pull Request by running: git pull https://github.com/pimenas/jclouds master Or you can view, comment on it, or merge it online at: https://github.com/jc