joshiste / spring-boot-admin-samples

Samples for Spring Boot Admin
119 stars 59 forks source link

Clients unable to register with oauth2 secured SBA 2.0 #7

Closed Sarvesh-D closed 6 years ago

Sarvesh-D commented 6 years ago

I am using spring boot 2 and spring boot admin 2. My SBA server is secured using spring security oauth2. I have seen your sample project for oauth. But when i my client application tries to register to SBA server, i get below error log:

2018-06-07 21:08:50.846 -DEBUG 52852 --- [gistrationTask1] d.c.b.a.c.r.ApplicationRegistrator       : Application failed to registered itself as Application [name=client-app, managementUrl=http://localhost:9090/client-app/management/, healthUrl=http://localhost:9090/client-app/management/health/, serviceUrl=http://localhost:9090/client-app/]. Response: <302 Found,{Set-Cookie=[JSESSIONID=02E0177501D3B9381586CBE642D482AD; Path=/; HttpOnly], X-Content-Type-Options=[nosniff], X-XSS-Protection=[1; mode=block], Cache-Control=[no-cache, no-store, max-age=0, must-revalidate], Pragma=[no-cache], Expires=[0], X-Frame-Options=[DENY], Location=[http://localhost:9000/login], Content-Length=[0], Date=[Thu, 07 Jun 2018 15:38:50 GMT]}>

In the logs i can see the client app is redirected to the SSO login path configured in SBA server. The client app already has security.oauth2.* properties set. Can you tell me what configuration i need to make on the client side?

joshiste commented 6 years ago

Normally Spring Security is returning a 401 for a rest call and only a 302 for page requests. So I guess it's more a problem with your spring security configuration. Did you see this issue? https://github.com/spring-projects/spring-boot/issues/12346

joshiste commented 6 years ago

please note that the samples are outdated.

rubenibarra commented 6 years ago

from spring boot admin 2.0 I have monitored via eureka to a microservice which exposes the actuator endpoint with oauth2; // sba client .antMatchers ("/ actuator / **"). hasRole ("ADMIN")

1- I get the token from a microservices oaut2 2- How do I send the token from sba to the actuator endpoint?