26
26
import org .eclipse .edc .identityhub .sts .accountservice .RandomStringGenerator ;
27
27
import org .eclipse .edc .identityhub .sts .accountservice .StsAccountServiceImpl ;
28
28
import org .eclipse .edc .junit .annotations .ComponentTest ;
29
+ import org .eclipse .edc .junit .assertions .AbstractResultAssert ;
29
30
import org .eclipse .edc .jwt .validation .jti .JtiValidationStore ;
30
31
import org .eclipse .edc .keys .KeyParserRegistryImpl ;
31
32
import org .eclipse .edc .keys .VaultPrivateKeyResolver ;
@@ -86,12 +87,13 @@ void setup() {
86
87
87
88
@ Test
88
89
void authenticateAndGenerateToken () throws Exception {
90
+ var participantId = "participant_id" ;
89
91
var clientId = "client_id" ;
90
92
var secretAlias = "client_secret_alias" ;
91
93
var privateKeyAlias = "client_id" ;
92
94
var audience = "aud" ;
93
95
var did = "did:example:subject" ;
94
- var client = createClientBuilder (clientId )
96
+ var client = createClientBuilder (participantId )
95
97
.clientId (clientId )
96
98
.privateKeyAlias (privateKeyAlias )
97
99
.secretAlias (secretAlias )
@@ -104,7 +106,7 @@ void authenticateAndGenerateToken() throws Exception {
104
106
vault .storeSecret (privateKeyAlias , loadResourceFile ("ec-privatekey.pem" ));
105
107
106
108
var createResult = clientService .createAccount (ParticipantManifest .Builder .newInstance ()
107
- .participantId (clientId )
109
+ .participantId (participantId )
108
110
.did (did )
109
111
.key (KeyDescriptor .Builder .newInstance ()
110
112
.keyId ("public-key" )
@@ -114,6 +116,9 @@ void authenticateAndGenerateToken() throws Exception {
114
116
assertThat (createResult .succeeded ()).isTrue ();
115
117
116
118
var tokenResult = tokenGeneratorService .tokenFor (client , additional );
119
+
120
+ AbstractResultAssert .assertThat (tokenResult ).isSucceeded ();
121
+
117
122
var jwt = SignedJWT .parse (tokenResult .getContent ().getToken ());
118
123
119
124
assertThat (jwt .getJWTClaimsSet ().getClaims ())
@@ -127,13 +132,14 @@ void authenticateAndGenerateToken() throws Exception {
127
132
128
133
@ Test
129
134
void authenticateAndGenerateToken_withBearerAccessScope () throws Exception {
135
+ var participantId = "participant_id" ;
130
136
var clientId = "client_id" ;
131
137
var secretAlias = "client_secret_alias" ;
132
138
var privateKeyAlias = "client_id" ;
133
139
var did = "did:example:subject" ;
134
140
var audience = "aud" ;
135
141
var scope = "scope:test" ;
136
- var client = createClientBuilder (clientId )
142
+ var client = createClientBuilder (participantId )
137
143
.clientId (clientId )
138
144
.privateKeyAlias (privateKeyAlias )
139
145
.secretAlias (secretAlias )
@@ -146,7 +152,7 @@ void authenticateAndGenerateToken_withBearerAccessScope() throws Exception {
146
152
vault .storeSecret (privateKeyAlias , loadResourceFile ("ec-privatekey.pem" ));
147
153
148
154
var createResult = clientService .createAccount (ParticipantManifest .Builder .newInstance ()
149
- .participantId (clientId )
155
+ .participantId (participantId )
150
156
.did (did )
151
157
.key (KeyDescriptor .Builder .newInstance ()
152
158
.keyId ("public-key" )
@@ -169,14 +175,15 @@ void authenticateAndGenerateToken_withBearerAccessScope() throws Exception {
169
175
170
176
@ Test
171
177
void authenticateAndGenerateToken_withAccessToken () throws Exception {
178
+ var participantId = "participant_id" ;
172
179
var clientId = "client_id" ;
173
180
var secretAlias = "client_secret_alias" ;
174
181
var privateKeyAlias = "client_id" ;
175
182
var audience = "aud" ;
176
183
var accessToken = "tokenTest" ;
177
184
var did = "did:example:subject" ;
178
185
179
- var client = createClientBuilder (clientId )
186
+ var client = createClientBuilder (participantId )
180
187
.clientId (clientId )
181
188
.privateKeyAlias (privateKeyAlias )
182
189
.secretAlias (secretAlias )
@@ -189,7 +196,7 @@ void authenticateAndGenerateToken_withAccessToken() throws Exception {
189
196
vault .storeSecret (privateKeyAlias , loadResourceFile ("ec-privatekey.pem" ));
190
197
191
198
var createResult = clientService .createAccount (ParticipantManifest .Builder .newInstance ()
192
- .participantId (clientId )
199
+ .participantId (participantId )
193
200
.did (did )
194
201
.key (KeyDescriptor .Builder .newInstance ()
195
202
.keyId ("public-key" )
0 commit comments