Commit Graph

74 Commits

Author SHA1 Message Date
Brian Clozel
b03097ad47 Remove attributes from Argument annotation
Prior to this commit, the `@Argument` annotation would support two
attributes: `required` and `defaultValue`, specifying whether arguments
should be considered as required and default values to use if they're
not present.

This can be problematic as this can already be specified at the schema
level.

To avoid duplication and invalid setups betweens schema and Controllers,
this commit removes those attributes in favor of the schema definition.

Closes gh-150
2021-09-24 13:47:56 +02:00
Brian Clozel
f69aa39211 Only scan for *.graphqls and *.gqls schema files
Prior to this commit, the auto-configuration was scanning for
`"*.graphql,*.gql,*.graphqls,*.gqls"` files in the configured locations.
This was not flexible enough, as developers could not customize the
considered file extensions when scanning for files.

This commit provides a new `spring.graphql.schema.file-extensions`
configuration property that enables such customizations.

Because `"*.graphql,*.gql"` extensions seem to be tied to queries
(and not schemas), this commit also changes the default value to only
consider the `"*.graphqls,*.gqls"` file extensions by default.

Closes gh-134
Closes gh-135
2021-09-20 10:29:41 +02:00
Brian Clozel
762f59b2f3 Configure compiler conventions in modules
This commit applies the Compiler Conventions Gradle plugin to the
project modules and fix the issues raised by the compiler linter.

This commit also moves version management to the main build file for a
few dependencies, aligning the versions in the process.
2021-09-16 19:54:25 +02:00
Rossen Stoyanchev
892d2bd344 Use properties for Boot and GraphQL Java versions 2021-09-16 11:15:47 +01:00
Rossen Stoyanchev
1b72e8107d Update Spring Boot version 2.5.0 -> 2.5.4 2021-09-16 10:21:45 +01:00
Rossen Stoyanchev
60e65078c2 Fix outdated links in README files 2021-08-31 07:44:10 +01:00
Rossen Stoyanchev
4bd229d4b9 Deprecate @GraphQlController in favor of @Controller 2021-08-30 14:56:01 +01:00
Rossen Stoyanchev
6a71dc958d Fix link in README
Closes gh-109
2021-08-11 05:31:10 +01:00
Rossen Stoyanchev
0d0b84dc8a Support for annotated DataFetcher's
Closes gh-61, gh-90
2021-08-09 12:37:47 +01:00
Rossen Stoyanchev
0dbc3f12cd Minor sample refactoring 2021-07-21 16:06:12 +01:00
Rossen Stoyanchev
69b2476231 Show config for test support in reference docs
Closes gh-96
2021-07-21 14:18:10 +01:00
Rossen Stoyanchev
a316c0411a Add GraphQlRepository annotation and update documentation
See gh-93
2021-07-20 15:59:34 +01:00
Rossen Stoyanchev
c148eb40b4 Auto registration of Querydsl DataFetcher's
See gh-93
2021-07-19 16:26:44 +01:00
Rossen Stoyanchev
1ea5e346b9 Fix links in sample README's 2021-07-07 09:02:51 +01:00
Rossen Stoyanchev
27e883164f Polishing websocket sample 2021-07-06 16:34:21 +01:00
Rossen Stoyanchev
16ee8ecde0 Add link to samples from top-level README 2021-07-06 16:23:28 +01:00
Rossen Stoyanchev
72ee49269f Polishing 2021-07-06 16:18:09 +01:00
Brian Clozel
289f4d0bac Simplify security samples
As of gh-81, specific security components are contributed by the
GraphQL Security auto-configuration.

This commit removes those from the custom SecurityConfig classes.
2021-07-06 17:02:38 +02:00
Rossen Stoyanchev
69c2d08c71 Remove formatter-on/off comments 2021-07-06 15:51:50 +01:00
Rossen Stoyanchev
b594c19526 Add security package with basic infrastructure
Closes gh-80, gh-82
2021-07-06 15:38:16 +01:00
Rossen Stoyanchev
aea229778c Add README files to samples 2021-07-06 15:35:23 +01:00
Rossen Stoyanchev
bac7461678 Add DataFetcherExceptionResolverAdapter
The adapter aims to:
- simplify the common case of synchronous resolution to a single error
- support ThreadLocal context propagation on an opt-in basis

This replaces the SyncDataFetcherExceptionResolver and removes the need
to propagate ThreadLocal context to every resolver.
2021-07-05 19:35:04 +01:00
Rossen Stoyanchev
16656d623f Polishing Javadoc and in security sample 2021-07-05 14:36:25 +01:00
Rossen Stoyanchev
f17ae9307c Extract schema handling and move into main spring-graphql module 2021-07-02 10:25:18 +01:00
Stephane Nicoll
9d4ebfe743 Polish 2021-06-30 15:44:24 +02:00
Rossen Stoyanchev
bbf152a32f Deserialize errorType from extensions
The errorType field on GraphQLError is specific to GraphQL Java and when
serialized via GraphqlErrorHelper#toSpecification it becomes an
extension with the key "classification".

This commit ensures that we correctly deserialize back to errorType from
the "classification" extension but unfortunately that's limited to the
ErrorClassification enums that we know of.
2021-06-29 14:53:50 +01:00
Rob Winch
dfebb6f53d webmvc-http-security uses WebGraphQlTester
Issue gh-58
2021-06-28 15:40:45 -05:00
Rob Winch
7d854dbf47 Add webmvc-http-security
Closes gh-58
2021-06-28 14:17:16 -05:00
Rossen Stoyanchev
4a6c718394 WebGraphQlTester supports HTTP header input
Closes gh-64
2021-06-26 17:48:30 +01:00
Rossen Stoyanchev
ed767d1a70 Polishing webflux-security 2021-06-26 05:16:45 +01:00
Rossen Stoyanchev
de234c94c4 Decouple GraphQlTester from Web details
Closes gh-65
2021-06-26 05:16:35 +01:00
Rossen Stoyanchev
17bf9ee287 Polishing
Closes gh-59
2021-06-24 21:13:14 +01:00
Mark Paluch
2d53fdc73f Spring Data repositories that support Querydsl
Spring Data repositories that support Querydsl are now supported
as DataFetchers returning single objects and iterables including
projection support.

See gh-59
2021-06-24 21:13:14 +01:00
Rob Winch
52572c91b0 SecurityDataFetcherExceptionResolver.setAuthenticationTrustResolver 2021-06-22 15:33:04 -05:00
Rob Winch
4aed51438a SecurityDataFetcherExceptionResolver handles AuthenticationException
This is unlikely to happen as authentication happens prior to reaching
the GraphQL APIs. However, a user may decide to implement security within
GraphQL as it is possible to do through a Spring Controller.
2021-06-22 15:32:38 -05:00
Rossen Stoyanchev
43f9e34c81 Turn off auto-formatting where it reduces readability 2021-06-15 14:01:52 +01:00
Rob Winch
b276a39902 Add SecurityDataFetcherExceptionResolver 2021-06-09 08:54:52 -05:00
Rob Winch
17a56a1000 Use New Lamda Security Syntax 2021-06-02 17:05:52 -05:00
Rob Winch
d139e97cdb Rename to SampleApplication
Follow convention of other sample applications.
2021-06-02 16:41:35 -05:00
Rob Winch
9a61207f2d Remove DataFetchers
Follow the conventions of the other sample projects.
2021-06-02 16:40:55 -05:00
Rob Winch
16f2baa263 Format webflux-security 2021-06-02 16:36:10 -05:00
Rob Winch
96d25b2a91 employee-service -> webflux-security 2021-06-02 13:36:40 -05:00
Rob Winch
05098fd5d1 Update to Spring Boot 2.5.0 2021-06-02 13:29:22 -05:00
Rob Winch
d3a0fa1c4f schema.graphqls->/graphql/schema.graphqls 2021-06-02 11:31:44 -05:00
Rob Winch
9b4c053a30 invalidCredentials 2021-06-02 11:31:44 -05:00
Rob Winch
ca369ecc7c salaryDataFetcher returns Mono
We need the return type to be a Reactor type for the context to be
propagated.
2021-06-02 11:31:44 -05:00
Rob Winch
84b9b65777 Use headers instead of WithMockUser
This ensures that we don't get false positives when the Reactor return
types are not continuous.
2021-06-02 11:31:44 -05:00
Rob Winch
4b44f7a987 Use ADMIN role 2021-06-02 11:31:44 -05:00
Andreas Marek
2edc4c585a add employee service example 2021-06-02 11:31:44 -05:00
Brian Clozel
f8b2ad552f Refactor project build
This commit refactors the project build to better share dependency
management definitions between modules.

This also upgrades the project to Spring Boot 2.5.0.

Closes gh-45
2021-06-02 15:45:51 +02:00