mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Refactoring webscript authentication to deal with redirecting etc. when no valid authentication for the script is available
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5718 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -202,7 +202,6 @@ public abstract class WebScriptRuntime
|
||||
//
|
||||
// Determine if user already authenticated
|
||||
//
|
||||
|
||||
currentUser = AuthenticationUtil.getCurrentUserName();
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
@@ -214,19 +213,18 @@ public abstract class WebScriptRuntime
|
||||
//
|
||||
// Apply appropriate authentication to Web Script invocation
|
||||
//
|
||||
|
||||
authenticate(required, isGuest);
|
||||
|
||||
//
|
||||
// Execute Web Script
|
||||
wrappedExecute(scriptReq, scriptRes);
|
||||
if (authenticate(required, isGuest))
|
||||
{
|
||||
//
|
||||
// Execute Web Script
|
||||
wrappedExecute(scriptReq, scriptRes);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
//
|
||||
// Reset authentication for current thread
|
||||
//
|
||||
|
||||
AuthenticationUtil.clearCurrentSecurityContext();
|
||||
if (currentUser != null)
|
||||
{
|
||||
@@ -293,8 +291,10 @@ public abstract class WebScriptRuntime
|
||||
*
|
||||
* @param required required level of authentication
|
||||
* @param isGuest is the request accessed as Guest
|
||||
*
|
||||
* @return true if authorised, false otherwise
|
||||
*/
|
||||
protected abstract void authenticate(RequiredAuthentication required, boolean isGuest);
|
||||
protected abstract boolean authenticate(RequiredAuthentication required, boolean isGuest);
|
||||
|
||||
/**
|
||||
* Pre-execution hook
|
||||
|
Reference in New Issue
Block a user