Skip to Content
avatar image
Former Member

Authenticate user from web service

Hello,

I am trying to create content in KM using a web service but all I get is a "com.sapportals.wcm.repository.AccessDeniedException: User <myuser> is not authenticated" error.

I have been able to create folders in KM with my web service using a service user (cmadmin_service) but I would like to do it with any user. (Actually I don't know why service users work)

This is my method to create folders:

	public String createFolder(String parentRID, String folderName, String user) {

		com.sapportals.portal.security.usermanagement.IUser iUser = null;
		String respuesta = null;		

		RID rid = RID.getRID(parentRID);

		try {

			iUser = WPUMFactory.getUserFactory().getUser(user);
			
			IResourceFactory factory = ResourceFactory.getInstance();
			IResourceContext context = new ResourceContext(iUser);
			
			ICollection parent = (ICollection)factory.getResource(rid, context);
			
			ICollection collection = parent.createCollection(folderName, null);
			respuesta = collection.getName();
			
		}
		catch(Exception e){
			
			respuesta = e.toString();
						
			
		}
				
		return respuesta;
 		
	}

How can I get "myuser" authenticated?

I hope you may help me, Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer