cancel
Showing results for 
Search instead for 
Did you mean: 

Webscript, Alf API, authentication, /wcservice unavailable

qwerty
Champ in-the-making
Champ in-the-making
Background

I've followed the guidlines as set out on http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples for writing Java-backed webscripts.

My webscripts does it's job and uses some Alfresco APIs that require authentication. In order to authenticate I have tried stuff like
AuthenticationUtil.setRunAsUser(String)
where the parameter supplied is my username, "admin", "System", AuthenticationUtil.getAdminUserName() etc etc

That all works and I make sure the script cleans up with
AuthenticationUtil.clearCurrentSecurityContext()
at the end.

Problem

The problem is that after running my webscript I can no longer get anything under /wcservice. By that I mean I get a HTTP 200 response but it is blank.

My hunch is that it's to do with authentication stuff I described above.

If I clear my browser data I can once again access things under /wcservice, but obviously this "solution" is far from ideal.

Any ideas anybody?
1 REPLY 1

rwetherall
Confirmed Champ
Confirmed Champ
Hi,

I think the issue you are seeing is possibly related to using the clearCurrentSecurityContext method. 

I would suggest using the runAs method on AuthenticationUtils.  This will ensure that the user is setup and reset in the correct way and prevents you from having to do things by hand.

Cheers,
Roy