Skip to content

Commit

Permalink
PR remark
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Sep 23, 2022
1 parent f582401 commit 97c673a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package org.eclipse.dataspaceconnector.boot.system.injection.lifecycle;

import org.eclipse.dataspaceconnector.runtime.metamodel.annotation.Inject;
import org.eclipse.dataspaceconnector.runtime.metamodel.annotation.Provider;
import org.eclipse.dataspaceconnector.spi.monitor.Monitor;
import org.eclipse.dataspaceconnector.spi.system.ServiceExtension;
Expand All @@ -25,9 +26,9 @@
* {@link ServiceExtension} implementors should not be constructed by just invoking their constructors, instead they need to go through
* a lifecycle, which is what this class aims at doing. There are three major phases for initialization:
* <ol>
* <li>inject dependencies: all fields annotated with {@link org.eclipse.dataspaceconnector.spi.system.Inject} are set</li>
* <li>inject dependencies: all fields annotated with {@link Inject} are set</li>
* <li>initialize: invokes the {@link ServiceExtension#initialize(ServiceExtensionContext)} method</li>
* <li>provide: invokes all methods annotated with {@link org.eclipse.dataspaceconnector.spi.system.Provider} to register more services into the context</li>
* <li>provide: invokes all methods annotated with {@link Provider} to register more services into the context</li>
* </ol>
* <p>
* The sequence of these phases is actually important.
Expand Down Expand Up @@ -62,7 +63,7 @@ public static RegistrationPhase initialize(InitializePhase phase) {
}

/**
* Scans the {@linkplain ServiceExtension} for methods annotated with {@linkplain org.eclipse.dataspaceconnector.spi.system.Provider}
* Scans the {@linkplain ServiceExtension} for methods annotated with {@linkplain Provider}
* with the {@link Provider#isDefault()} flag set to {@code false}, invokes them and registers the bean into the {@link ServiceExtensionContext} if necessary.
*/
public static PreparePhase provide(RegistrationPhase phase) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import org.eclipse.dataspaceconnector.iam.oauth2.spi.CredentialsRequestAdditionalParametersProvider;
import org.eclipse.dataspaceconnector.iam.oauth2.spi.NoopCredentialsRequestAdditionalParametersProvider;
import org.eclipse.dataspaceconnector.spi.system.Provider;
import org.eclipse.dataspaceconnector.runtime.metamodel.annotation.Provider;
import org.eclipse.dataspaceconnector.spi.system.ServiceExtension;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void obtainClientCredentials_addsAdditionalFormParameters() {
void verifyNoAudienceToken() {
var jwt = createJwt(null, Date.from(now.minusSeconds(1000)), Date.from(now.plusSeconds(1000)));

var result = authService.verifyJwtToken(jwt, PROVIDER_AUDIENCE);
var result = authService.verifyJwtToken(jwt, ENDPOINT_AUDIENCE);

assertThat(result.succeeded()).isFalse();
assertThat(result.getFailureMessages()).isNotEmpty();
Expand All @@ -186,7 +186,7 @@ void verifyNoAudienceToken() {
void verifyInvalidAudienceToken() {
var jwt = createJwt("different.audience", Date.from(now.minusSeconds(1000)), Date.from(now.plusSeconds(1000)));

var result = authService.verifyJwtToken(jwt, PROVIDER_AUDIENCE);
var result = authService.verifyJwtToken(jwt, ENDPOINT_AUDIENCE);

assertThat(result.succeeded()).isFalse();
assertThat(result.getFailureMessages()).isNotEmpty();
Expand All @@ -196,7 +196,7 @@ void verifyInvalidAudienceToken() {
void verifyInvalidAttemptUseNotBeforeToken() {
var jwt = createJwt(PROVIDER_AUDIENCE, Date.from(now.plusSeconds(1000)), Date.from(now.plusSeconds(1000)));

var result = authService.verifyJwtToken(jwt, PROVIDER_AUDIENCE);
var result = authService.verifyJwtToken(jwt, ENDPOINT_AUDIENCE);

assertThat(result.succeeded()).isFalse();
assertThat(result.getFailureMessages()).isNotEmpty();
Expand All @@ -206,7 +206,7 @@ void verifyInvalidAttemptUseNotBeforeToken() {
void verifyExpiredToken() {
var jwt = createJwt(PROVIDER_AUDIENCE, Date.from(now.minusSeconds(1000)), Date.from(now.minusSeconds(1000)));

var result = authService.verifyJwtToken(jwt, PROVIDER_AUDIENCE);
var result = authService.verifyJwtToken(jwt, ENDPOINT_AUDIENCE);

assertThat(result.succeeded()).isFalse();
assertThat(result.getFailureMessages()).isNotEmpty();
Expand Down

0 comments on commit 97c673a

Please sign in to comment.