oltu-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (OLTU-126) No enum constant GrantType.password
Date Tue, 29 Oct 2013 22:55:26 GMT

     [ https://issues.apache.org/jira/browse/OLTU-126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Christian closed OLTU-126.
--------------------------

    Resolution: Not A Problem

> No enum constant GrantType.password
> -----------------------------------
>
>                 Key: OLTU-126
>                 URL: https://issues.apache.org/jira/browse/OLTU-126
>             Project: Apache Oltu
>          Issue Type: Bug
>          Components: oauth2-authzserver, oauth2-client, oauth2-common
>    Affects Versions: 0.31
>         Environment: JBoss 7.1.1
>            Reporter: Christian
>            Priority: Critical
>
> There seems a problem with de-/serialization of {{GrantType}}s. When using the Oltu client
for own services, the {{GrantType}} is serialized by the {{toString()}} method, which returns
lower case identifiers.
> {code:java}
>         OAuthClientRequest request = OAuthClientRequest
>                 .tokenLocation("http://localhost:8080" + CONTEXT_PATH + "/oauth2/token")
>                 .setClientId("test")
>                 .setGrantType(GrantType.PASSWORD)
>                 .setUsername(email)
>                 .setPassword(password)
>                 .buildBodyMessage();
>         OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
>         OAuthJSONAccessTokenResponse oauthResponse = oAuthClient.accessToken(request);
> {code}
> While on the server {{OAuthUnauthenticatedTokenRequest}}'s constructor will call {{GrantType.valueOf(String)}},
which only accepts upper case identifiers.
> That results in an exception:
> {quote}
> java.lang.IllegalArgumentException: No enum constant org.apache.oltu.oauth2.common.message.types.GrantType.password
>  at java.lang.Enum.valueOf(Enum.java:236) [rt.jar:1.7.0_45]
>  at org.apache.oltu.oauth2.common.message.types.GrantType.valueOf(GrantType.java:29)
[org.apache.oltu.oauth2.common-0.31.jar:0.31
>  at org.example.oauth2.TokenEndpoint.authorize(TokenEndpoint.java:60) [example-services-1.0.0-SNAPSHOT.jar:]
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_45]
>  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_45]
>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.7.0_45]
>  at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_45]
>  at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155) [resteasy-jaxrs-2.3.2.Final.jar:]
>  at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.2.Final.jar:]
>  at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.2.Final.jar:]
>  at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.2.Final.jar:]
> {quote}



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message