-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 675-render-api-docs-from-typespec-model
- Loading branch information
Showing
52 changed files
with
393 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
config ?= compileClasspath | ||
config ?= runtimeClasspath | ||
|
||
ifdef module | ||
mm = :${module}: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.13.8 | ||
1.13.11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,44 +19,40 @@ | |
package io.seqera.wave.auth | ||
|
||
import groovy.util.logging.Slf4j | ||
import io.micronaut.core.annotation.NonNull | ||
import io.micronaut.core.annotation.Nullable | ||
import io.micronaut.http.HttpRequest | ||
import io.micronaut.security.authentication.AuthenticationProvider | ||
import io.micronaut.security.authentication.AuthenticationFailureReason | ||
import io.micronaut.security.authentication.AuthenticationRequest | ||
import io.micronaut.security.authentication.AuthenticationResponse | ||
import io.micronaut.security.authentication.provider.HttpRequestAuthenticationProvider | ||
import io.seqera.wave.service.account.AccountService | ||
import io.seqera.wave.util.StringUtils | ||
import jakarta.inject.Inject | ||
import jakarta.inject.Singleton | ||
import org.reactivestreams.Publisher | ||
import reactor.core.publisher.Flux | ||
import reactor.core.publisher.FluxSink | ||
/** | ||
* Basic Authentication provider | ||
* | ||
* @author Munish Chouhan <[email protected]> | ||
*/ | ||
@Slf4j | ||
@Singleton | ||
class BasicAuthenticationProvider implements AuthenticationProvider { | ||
class BasicAuthenticationProvider<B> implements HttpRequestAuthenticationProvider<B> { | ||
|
||
@Inject | ||
private AccountService accountService | ||
|
||
@Override | ||
Publisher<AuthenticationResponse> authenticate(@Nullable HttpRequest<?> httpRequest, AuthenticationRequest<?, ?> authRequest) { | ||
Flux.create(emitter -> { | ||
final user = authRequest.identity?.toString() | ||
final pass = authRequest.secret?.toString() | ||
if (accountService.isAuthorised(user, pass)) { | ||
log.trace "Auth request OK - user '$user'; password: '${StringUtils.redact(pass)}'" | ||
emitter.next(AuthenticationResponse.success((String) authRequest.identity)) | ||
emitter.complete() | ||
} | ||
else { | ||
log.trace "Auth request FAILED - user '$user'; password: '${StringUtils.redact(pass)}'" | ||
emitter.error(AuthenticationResponse.exception()) | ||
} | ||
}, FluxSink.OverflowStrategy.ERROR) | ||
AuthenticationResponse authenticate(@Nullable HttpRequest<B> httpRequest, @NonNull AuthenticationRequest<String, String> authRequest) { | ||
final user = authRequest.identity?.toString() | ||
final pass = authRequest.secret?.toString() | ||
if (accountService.isAuthorised(user, pass)) { | ||
log.trace "Auth request OK - user '$user'; password: '${StringUtils.redact(pass)}'" | ||
return AuthenticationResponse.success(authRequest.identity) | ||
} | ||
else { | ||
log.trace "Auth request FAILED - user '$user'; password: '${StringUtils.redact(pass)}'" | ||
return AuthenticationResponse.failure(AuthenticationFailureReason.CREDENTIALS_DO_NOT_MATCH) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.