Class GitHubUsersApiFactory
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.github.GitHubUsersApiFactory
Builds the users client generated from the GitHub contract for one call. The generated
ApiClient keeps its
base path and bearer token as mutable state, and both change with every sign-in (the base path comes from the
registration, the token from the user), so a shared instance would mix the calls of concurrent sign-ins: each call
gets its own client on top of one shared, thread-safe RestClient.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.springframework.web.client.RestClientHTTP client every generated client sends its requests through. -
Constructor Summary
ConstructorsConstructorDescriptionGitHubUsersApiFactory(org.springframework.web.client.RestClient.Builder builder) Creates the factory. -
Method Summary
-
Field Details
-
restClient
private final org.springframework.web.client.RestClient restClientHTTP client every generated client sends its requests through.
-
-
Constructor Details
-
GitHubUsersApiFactory
public GitHubUsersApiFactory(org.springframework.web.client.RestClient.Builder builder) Creates the factory.- Parameters:
builder- builder of REST clients configured by Spring Boot (message converters, observations).
-
-
Method Details
-
create
Builds the client of one call.- Parameters:
basePath- base URI of GitHub's API, without a trailing slash.accessToken- GitHub access token of the user, sent as the bearer token.- Returns:
- the generated users client.
-