diff options
| author | Shireesh Anjal <shireesh@gluster.com> | 2011-03-16 12:37:25 +0530 |
|---|---|---|
| committer | Shireesh Anjal <shireesh@gluster.com> | 2011-03-16 12:37:25 +0530 |
| commit | 608ec97c38e95b1e3bfec57daaa0244854c7c3be (patch) | |
| tree | 11723ccfae2ca07f5d35903b870a7b0958c1d817 /com.gluster.storage.management.server | |
| parent | ba2140d703464f1dd378da6c5655aaa1d9020414 (diff) | |
Modified to return Status object from user login method instead of AuthStatus. Removed the AuthStatus class.
Signed-off-by: Shireesh Anjal <shireesh@gluster.com>
Diffstat (limited to 'com.gluster.storage.management.server')
| -rw-r--r-- | com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/UsersResource.java | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/UsersResource.java b/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/UsersResource.java index 02d1f763..51134317 100644 --- a/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/UsersResource.java +++ b/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/UsersResource.java @@ -20,11 +20,10 @@ package com.gluster.storage.management.server.resources; import javax.ws.rs.FormParam; import javax.ws.rs.GET; -import javax.ws.rs.POST; +import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.springframework.beans.factory.annotation.Autowired; @@ -34,7 +33,6 @@ import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.provisioning.JdbcUserDetailsManager; import org.springframework.stereotype.Component; -import com.gluster.storage.management.core.model.AuthStatus; import com.gluster.storage.management.core.model.Status; import com.sun.jersey.spi.resource.Singleton; @@ -68,20 +66,17 @@ public class UsersResource { * return false; } */ - @Path("{user}/login") + @Path("{user}") @GET @Produces(MediaType.TEXT_XML) - public AuthStatus login(@PathParam("user") String user, @QueryParam("password") String password) { - - AuthStatus authStatus = new AuthStatus(); + public Status login(@PathParam("user") String user) { // success only if the user passed in query is same as the one passed in security header - authStatus.setIsAuthenticated(SecurityContextHolder.getContext().getAuthentication().getName().equals(user)); - - return authStatus; + return (SecurityContextHolder.getContext().getAuthentication().getName().equals(user) ? Status.STATUS_SUCCESS + : Status.STATUS_FAILURE); } - @Path("{user}/changepassword") - @POST + @Path("{user}") + @PUT @Produces(MediaType.TEXT_XML) public Status changePassword(@FormParam("oldpassword") String oldPassword, @FormParam("newpassword") String newPassword) { |
