cancel
Showing results for 
Search instead for 
Did you mean: 

How to Invoke Person Service & Authentication Service from external web application?

aoakash83
Champ in-the-making
Champ in-the-making
Hello All,

I am trying to search the user based on the user name and if he is not present then creating the user using using createPerson of Person Service.

Because mine is an external web application, I want to know that how can I configure these services in springs context.

I found a post which is really good, but in order to implement that I need to understand how can I configure these services - https://forums.alfresco.com/forum/developer-discussions/development-environment/create-user-alfresco...

If someone can provide me an example that would be really great.

Thanks in advance.
6 REPLIES 6

mitpatoliya
Star Collaborator
Star Collaborator
You can simply consume cmis services exposed by alfresco in your web application.
Please go through this link
http://www.alfresco.com/cmis

You will get some more idea.

Hello Mits,

Thanks for your reply, but what I have understood so far is that Alfresco does expose the services and there are 2 ways to invoke it :
1) Restful services  through which I can find user and then create the users http://localhost:8080/alfresco/service/api/people?userName=xyz

2) The way I have mentioned in my question by using authentication service & create person service.

In first approach I have to generate a token then need to pass it to URL etc.

However, I want to use second approach where I think I can configure the bean definitions of Alfresco in my application context and invoke the services. But I need some pointer/examples how to configure those beans in application context of my web application.

Could you provide any help on it.

Thanks.

mrogers
Star Contributor
Star Contributor
You only have access to the "beans" of alfresco if you embed alfresco within your application.   In which case just include the spring framework within your application and cut down alfresco's application-context.xml as neccesary.   There used to be SDK examples of this however that's all obsolete with the move to maven.

Otherwise you need to call one of alfresco's many remote APIs.    Or add your own services to alfresco.

aoakash83
Champ in-the-making
Champ in-the-making
Many thanks for your reply mrogers.

I got your point, so what do you suggest shall I use the Restfull API of Alfresco like
1) http://localhost:8080/alfresco/service/api/login?u=admin&pw=alfresco to get the token and
2) http://localhost:8080/alfresco/service/api/people?userName=abc&alf_ticket='+token, to search whether the user is present or not.
3) and finally pass all the details like username, name password and email address for the creation.

Let me know if my understanding is correct?

Thanks

mrogers
Star Contributor
Star Contributor
Yes.    You could also look at how Alfresco Share does it since that functionality already exists.

aoakash83
Champ in-the-making
Champ in-the-making
Thanks mroger…I will give it a try.