401 UNAUTHORIZED from REST API in springboot

Hi All,

We have a spring boot application implemented with camunda and using the REST APIs provided by default which was working fine with below URL.

URL: http://localhost:61022/rest/process-definition/key/createRequest/start

Now we are implementing OAUTH2 Security for one of the rest service being invoked by our camunda application for which below dependency was added and new RestTemplate was created.

		<dependency>
			<groupId>org.springframework.security.oauth</groupId>
			<artifactId>spring-security-oauth2</artifactId>
			<version>2.3.3.RELEASE</version>
		</dependency>

After adding this we are getting below 401 UNAUTHORIZED Exception for all the REST API calls made to camunda.

ERROR com.service.RestService.postJsonToCamunda - HttpClient Exception occured in RestService: 401 UNAUTHORIZED
at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:81)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:123)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102)
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:785)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:743)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:677)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:586)
at com.service.RestService.postJsonToCamunda(RestService.java:103)
at java.lang.Thread.run(Thread.java:748)

As far as I am aware there is Basic authentication available in camunda but this is disabled by default, I have tried changing URL as suggested in this post but no change.

Please help to resolve this.

Thanks
Manohar

Hi All,

Resolved it by adding the filter configuration as per post and configuring basic authentication using spring security.

However still I am not sure how was basic authentication enabled and 401 error was thrown by adding OAUTH2 spring dependency. Also How can this be disabled.

Thanks
Manohar