Code Monkey home page Code Monkey logo

springboot-graphql-sqqr-jwt-demo's People

Contributors

blacktoviche avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

springboot-graphql-sqqr-jwt-demo's Issues

cors problem

Hello, thanks for this excellent example.

I am using your code in my application and I am able to login using postman and insomia, but when I try to login from my client application (vue.js app) I am getting the following error:

Access to fetch at 'http://localhost:9010/graphql' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Can you please show me how to configure cors in the server?

Thanks.

Luis

Signin Request is not filtered

My SecurityConfig file is as follows

@OverRide
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.csrf().disable()
.authorizeRequests()
.antMatchers("/graphql").permitAll()
.antMatchers("/graphiql").permitAll()
.anyRequest().authenticated();

    JwtFilter authenticationFilter = new JwtFilter(userDetailsService(), jwtTokenUtil);
  httpSecurity.addFilterBefore(authenticationFilter, UsernamePasswordAuthenticationFilter.class);
}

When i execute signin mutation, It also went to filter. Since it does not get any token so its gets blocked. Why is it so?

Filtering all requests

With this implementation of JwtFilter, all queries/mutations are run through the filter. Wouldn't you need to allow a mutation that can initially create an account in the first place? In this case, the client would not have a JWT token to provide.

If one were to throw an error here when a token was not provided, one could not allow queries/mutations to come through, however, this blocks the ability to create an account/sign in initially.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.