mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
fix login bug
This commit is contained in:
@@ -38,6 +38,9 @@ package sonia.scm.api.rest.resources;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.ScmState;
|
import sonia.scm.ScmState;
|
||||||
import sonia.scm.Type;
|
import sonia.scm.Type;
|
||||||
import sonia.scm.repository.RepositoryManager;
|
import sonia.scm.repository.RepositoryManager;
|
||||||
@@ -69,6 +72,12 @@ import javax.ws.rs.core.Response;
|
|||||||
public class AuthenticationResource
|
public class AuthenticationResource
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** the logger for AuthenticationResource */
|
||||||
|
private static final Logger logger =
|
||||||
|
LoggerFactory.getLogger(AuthenticationResource.class);
|
||||||
|
|
||||||
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
@@ -133,21 +142,28 @@ public class AuthenticationResource
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GET
|
@GET
|
||||||
public ScmState getState(@Context HttpServletRequest request)
|
public Response getState(@Context HttpServletRequest request)
|
||||||
{
|
{
|
||||||
|
Response response = null;
|
||||||
ScmState state = null;
|
ScmState state = null;
|
||||||
User user = securityContext.getUser();
|
User user = securityContext.getUser();
|
||||||
|
|
||||||
if (user != null)
|
if (user != null)
|
||||||
{
|
{
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("return state for user {}", user.getName());
|
||||||
|
}
|
||||||
|
|
||||||
state = getState(user);
|
state = getState(user);
|
||||||
|
response = Response.ok(state).build();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
|
response = Response.status(Response.Status.UNAUTHORIZED).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
return state;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -29,8 +29,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// enable debug mode, if console is available
|
||||||
|
var debug = Ext.isDefined(console);
|
||||||
|
|
||||||
var debug = true;
|
|
||||||
var state = null;
|
var state = null;
|
||||||
|
|
||||||
// sonia.scm.api.rest.resources.UserResource.DUMMY_PASSWORT
|
// sonia.scm.api.rest.resources.UserResource.DUMMY_PASSWORT
|
||||||
|
|||||||
Reference in New Issue
Block a user