mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
13003: Fix for ETHREEOH-1241. Improved debug logging also. 13027: Fix for build failure - OKed solution from Dave/Andy git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13533 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -188,11 +188,11 @@
|
|||||||
|
|
||||||
<!-- Authentication APIs -->
|
<!-- Authentication APIs -->
|
||||||
<bean id="webscript.org.alfresco.repository.login.get" class="org.alfresco.repo.web.scripts.bean.Login" parent="webscript">
|
<bean id="webscript.org.alfresco.repository.login.get" class="org.alfresco.repo.web.scripts.bean.Login" parent="webscript">
|
||||||
<property name="authenticationService" ref="authenticationService" />
|
<property name="authenticationService" ref="AuthenticationService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="webscript.org.alfresco.repository.login.post" class="org.alfresco.repo.web.scripts.bean.LoginPost" parent="webscript">
|
<bean id="webscript.org.alfresco.repository.login.post" class="org.alfresco.repo.web.scripts.bean.LoginPost" parent="webscript">
|
||||||
<property name="authenticationService" ref="authenticationService" />
|
<property name="authenticationService" ref="AuthenticationService" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="webscript.org.alfresco.repository.loginticket.get" class="org.alfresco.repo.web.scripts.bean.LoginTicket" parent="webscript">
|
<bean id="webscript.org.alfresco.repository.loginticket.get" class="org.alfresco.repo.web.scripts.bean.LoginTicket" parent="webscript">
|
||||||
|
@@ -30,6 +30,7 @@ import java.util.Map;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
import org.alfresco.web.scripts.DeclarativeWebScript;
|
import org.alfresco.web.scripts.DeclarativeWebScript;
|
||||||
import org.alfresco.web.scripts.Status;
|
import org.alfresco.web.scripts.Status;
|
||||||
@@ -38,7 +39,7 @@ import org.alfresco.web.scripts.WebScriptRequest;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* common code between Get based login and POST based login
|
* Common code between Get based login and POST based login
|
||||||
*/
|
*/
|
||||||
/* package scope */ abstract class AbstractLoginBean extends DeclarativeWebScript
|
/* package scope */ abstract class AbstractLoginBean extends DeclarativeWebScript
|
||||||
{
|
{
|
||||||
@@ -65,7 +66,6 @@ import org.alfresco.web.scripts.WebScriptRequest;
|
|||||||
|
|
||||||
protected Map<String, Object> login(String username, String password)
|
protected Map<String, Object> login(String username, String password)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// get ticket
|
// get ticket
|
||||||
@@ -82,7 +82,7 @@ import org.alfresco.web.scripts.WebScriptRequest;
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
authenticationService.clearCurrentSecurityContext();
|
AuthenticationUtil.clearCurrentSecurityContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -63,5 +63,4 @@ public class Login extends AbstractLoginBean
|
|||||||
|
|
||||||
return login(username, password);
|
return login(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -41,11 +41,9 @@ import org.json.JSONObject;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Post based login script
|
* Post based login script
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class LoginPost extends AbstractLoginBean
|
public class LoginPost extends AbstractLoginBean
|
||||||
{
|
{
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
|
* @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.WebScriptResponse)
|
||||||
*/
|
*/
|
||||||
@@ -55,14 +53,15 @@ public class LoginPost extends AbstractLoginBean
|
|||||||
Content c = req.getContent();
|
Content c = req.getContent();
|
||||||
if (c == null)
|
if (c == null)
|
||||||
{
|
{
|
||||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Missing POST body.");
|
||||||
"Missing POST body.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO accept xml type.
|
// TODO accept xml type.
|
||||||
|
|
||||||
// extract username and password from JSON object
|
// extract username and password from JSON object
|
||||||
JSONObject json;
|
JSONObject json;
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
json = new JSONObject(c.getContent());
|
json = new JSONObject(c.getContent());
|
||||||
String username = json.getString("username");
|
String username = json.getString("username");
|
||||||
String password = json.getString("password");
|
String password = json.getString("password");
|
||||||
|
Reference in New Issue
Block a user