Skip to content

Commit 54aceb5

Browse files
authored
Merge pull request #97 from zalando-nakadi/fake-access-toke-uri
Fix #93 Do not require nakadi-producer.access-token-uri anymore
2 parents b7a8962 + 7ad0600 commit 54aceb5

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,9 @@ token. The easiest way to do so is to include the [Zalando Tokens library](https
104104
</dependency>
105105
```
106106

107-
This starter will detect and auto configure it. To do so, it needs to know the address of your oAuth2 server:
108-
```yaml
109-
nakadi-producer:
110-
access-token-uri: https://token.auth.example.org/oauth2/access_token
111-
```
107+
This starter will detect and auto configure it.
112108

113-
If your application is running in Zalando's Kubernetes environment, you also have to configure the credential rotation:
109+
If your application is running in Zalando's Kubernetes environment, you have to configure the credential rotation:
114110
```yaml
115111
apiVersion: "zalando.org/v1"
116112
kind: PlatformCredentialsSet
@@ -124,18 +120,27 @@ spec:
124120
privileges: []
125121
```
126122
123+
If your application is running in Zalando's STUPS environment (or you provide tokens via your own oAuth server) it needs
124+
to know the address of your oAuth2 server:
125+
```yaml
126+
nakadi-producer:
127+
access-token-uri: https://token.auth.example.org/oauth2/access_token
128+
```
129+
130+
#### OAuth (scope) configuration in a non-Zalando environment
131+
Please consult the [manual of Zalando's tokens library](https://github.com/zalando/tokens) for more configuration options (like `CREDENTIALS_DIR` or via environment variables.
132+
127133
Since [July 2017](https://github.com/zalando/nakadi/pull/692), Nakadi (at least in the version operated at Zalando) doesn't require any scopes other than the pseudo-scope `uid` for writing events, [the authorization is instead based on event-type configuration using the service's uid](https://nakadi.io/manual.html#using_authorization).
128134

129135
If your Nakadi installation needs real scopes for submitting events, you can provide them via configuration, too (as a comma-separated list):
130136

131137
```yaml
132138
nakadi-producer:
133-
access-token-uri: https://token.auth.example.org/oauth2/access_token
134139
access-token-scopes: my.scope.name,other.scope.name
135-
```
136-
137-
If you do not use the STUPS Tokens library, you can implement token retrieval yourself by defining a Spring bean of type `org.zalando.nakadiproducer.AccessTokenProvider`. The starter will detect it and call it once for each request to retrieve the token.
140+
```
138141

142+
#### Implement Nakadi authentication yourself
143+
If you do not use the STUPS Tokens library, you can implement token retrieval yourself by defining a Spring bean of type `org.zalando.nakadiproducer.AccessTokenProvider`. The starter will detect it and call it once for each request to retrieve the token.
139144

140145
### Creating events
141146

nakadi-producer-spring-boot-starter/src/main/java/org/zalando/nakadiproducer/NakadiProducerAutoConfiguration.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ public NakadiPublishingClient nakadiProducerPublishingClient(AccessTokenProvider
6363
@Configuration
6464
static class StupsTokenConfiguration {
6565
@Bean(destroyMethod = "stop")
66-
@ConditionalOnProperty({ "nakadi-producer.access-token-uri" })
6766
@ConditionalOnMissingBean(AccessTokenProvider.class)
6867
public StupsTokenComponent accessTokenProvider(
69-
@Value("${nakadi-producer.access-token-uri}") URI accessTokenUri,
68+
@Value("${nakadi-producer.access-token-uri:http://nakadi-producer.access-token-uri.not-set}") URI accessTokenUri,
7069
@Value("${nakadi-producer.access-token-scopes:uid}") String[] accessTokenScopes) {
7170
return new StupsTokenComponent(accessTokenUri, Arrays.asList(accessTokenScopes));
7271
}
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
nakadi-producer:
2-
access-token-uri: http://localhost:1234
32
nakadi-base-uri: https://nakadi.example.org:5432
43
management.endpoints.web.exposure.include: snapshot-event-creation

0 commit comments

Comments
 (0)