only2dhir / spring-boot-security-oauth2

This article aims to provide a working example of spring boot security and oauth2. It has implementation for resource server and authorization server and connection to database with bcrypt password encoder.
http://www.devglan.com/spring-security/spring-boot-security-oauth2-example
81 stars 75 forks source link

There is no client authentication. Try adding an appropriate authentication filter. #1

Closed mainul35 closed 5 years ago

mainul35 commented 6 years ago

when I try to access /oauth/token, it shows the following error.

{
    "error": "unauthorized",
    "error_description": "There is no client authentication. Try adding an appropriate authentication filter."
}
only2dhir commented 6 years ago

Which version of spring boot you are using. If it's not version 2, then it should work. Just now I tried with URL - localhost:8080/oauth/token or else follow the instructions here - http://www.devglan.com/spring-security/spring-boot-security-oauth2-example

mainul35 commented 6 years ago

​I found the problem. It was my fault. Thanks a lot for your feedback.​

https://mailtrack.io/ Sent with Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality&

On Tue, May 8, 2018 at 5:51 PM, Dhiraj Ray notifications@github.com wrote:

Which version of spring boot you are using. If it's not version 2, then it should work. Just now I tried with URL - localhost:8080/oauth/token or else follow the instructions here - http://www.devglan.com/spring- security/spring-boot-security-oauth2-example

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/only2dhir/spring-boot-security-oauth2/issues/1#issuecomment-387377190, or mute the thread https://github.com/notifications/unsubscribe-auth/AJRhEjNwd5E02Wbjf7xvuxu1cd-uhQPVks5twYaygaJpZM4T2c74 .

-- Syed Mainul Hasan

suddeveloper commented 6 years ago

What was the solution? I have a similar issue.

lordleebo commented 5 years ago

I had the same problem, just make sure spring security filter is configured and running

raulvillalbamedina commented 5 years ago

@mainul35 what is the solution please?

lordleebo commented 5 years ago

Hi,

In my case the solution was to add the following lines to web.xml file to activate the security filter.

springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /*

El mié., 3 abr. 2019 a las 10:17, Raúl Villalba medina (< notifications@github.com>) escribió:

@mainul35 https://github.com/mainul35 what is the solution please?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/only2dhir/spring-boot-security-oauth2/issues/1#issuecomment-479534650, or mute the thread https://github.com/notifications/unsubscribe-auth/AKE98wTRBmj4EXMC9KzylTQcQTppEi70ks5vdMYfgaJpZM4T2c74 .

raulvillalbamedina commented 5 years ago

Solved!

@xbisquerra find this in our code

`@Configuration public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

@Override
public void configure(WebSecurity web) throws Exception {
    web.ignoring().antMatchers("/**");
}

}`

he change to this

`@Configuration public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

@Override
public void configure(WebSecurity web) throws Exception {
    web.ignoring().antMatchers("/actuator/**");
}

}`

And all is ok, we ccall with curl to oauth/token ok, and we can use /actuator/ endpoints too.

We add to github a sample of config https://github.com/raulvillalbamedina/spring-boot-oauth2-simple

Thank you!