Commit Graph

35 Commits

Author SHA1 Message Date
rstoyanchev
3214a9cfc9 Introduce GraphQlClientException hierarchy
Refine exception handling and ensure a hierarchy of exceptions that
allows differentiating between transport errors vs field errors while
accessing an invalid data or field.

See gh-10
2022-03-15 09:00:28 +00:00
rstoyanchev
1e652f800b Polishing 2022-03-10 09:48:37 +00:00
rstoyanchev
4818ee6c81 Upgrade samples to match the GraphQlTest updates
See gh-310
2022-03-09 12:47:26 +00:00
rstoyanchev
19793a6e74 Revert "Pin version to 1.0.0-M5 in samples"
This reverts commit b40375f1f2.
2022-03-09 08:57:10 +00:00
rstoyanchev
b40375f1f2 Pin version to 1.0.0-M5 in samples
This is necessary until Boot catches up with spring-graphql snapshots.
2022-03-07 10:39:59 +00:00
Brian Clozel
410e7e60ae Revisit Gradle repositories configuration 2022-01-19 14:22:04 +01:00
Brian Clozel
a15fd29fc0 Remove Spring Boot Experimental Starter
The Experimental Spring Boot Starter for Spring GraphQL has been moved
to Spring Boot and will be released with Spring Boot 2.7.0.

Closes gh-207
2021-12-21 14:09:17 +01:00
Brian Clozel
02d6cb1c59 Refine GraphQL testing infrastructure
After the introduction of the `@GraphQlTest` annotation, this commit
adds further refinements to the testing infrastructure.

Now, `@GraphQlTest` is completely independent of any web framework and
contributes a `GraphQlTester` component.

`@SpringBootTest` integration tests with mock servers only require an
`@AutoConfigureWebGraphQlTest` to get a `WebGraphQlTester` component.

Closes gh-75
2021-10-27 21:16:03 +02:00
Brian Clozel
e053e14158 Add GraphQlTest annotation
Prior to this commit, we could only test Spring GraphQL applications
with a complete application - all application and infrastructure
components were involved. While using `@SpringBootTest` is often useful
for complete integration tests (with or without a live running server),
we often want to write lean integration tests and test slices of our
application.

Just like `@WebMvcTest` or `@WebFluxTest`, this commit introduces the
support for `@GraphQlTest`. This annotation helps us to test a
particular slice of our application: a hand-picked selection of
`@Controller`, plus `RuntimeWiringConfigurer` and `WebInterceptor`
beans.

Other `@Component` must be imported or mocked for those tests.

This commit also refactors the existing auto-configuration to enable
this use case. The `WebGraphQlHandlerAutoConfiguration` now holds the
required components for `@GraphQlTest`, while other web-related
auto-configurations bring the web framework and transport
infrastructures.

Closes gh-75
2021-10-22 22:00:02 +02:00
Rossen Stoyanchev
21d9791484 Update reference docs for access to HTTP headers
Also rename existing methods for request headers to be consistent with
those for response headers and use "Http" in the name.

Closes gh-74
2021-10-01 17:36:49 +01:00
Rossen Stoyanchev
762b9f06c2 Support query files for input in GraphQlTester
Closes gh-67
2021-10-01 17:36:49 +01: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
4bd229d4b9 Deprecate @GraphQlController in favor of @Controller 2021-08-30 14:56:01 +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
1ea5e346b9 Fix links in sample README's 2021-07-07 09:02:51 +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
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
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
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