-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client Side Tracing & OAuth implementation #66
Merged
Merged
Changes from 8 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9b1725b
Implemented Quarkus Client Side Tracing
SravanThotakura05 3b94300
Code formatting
SravanThotakura05 fbf0156
changed system name in tracing
SravanThotakura05 ee61f76
Merge branch 'main' into tracing
SravanThotakura05 843c7fb
Configured tracing in test broker and added user properties
SravanThotakura05 07fd1d9
Merge branch 'main' into tracing
SravanThotakura05 f511069
OAuth implementation
SravanThotakura05 c8c0230
changed queue name in tracing test
SravanThotakura05 5fa5d97
Integration test for Solace OAuth client authentication
SravanThotakura05 0aa31cb
code formatting
SravanThotakura05 d8fb8f5
updated alive to set to true by default
SravanThotakura05 6e4b0ff
Documentation update
SravanThotakura05 88cdb2e
Updated documentation
SravanThotakura05 8a1d6d4
Merge branch 'main' into tracing
SravanThotakura05 a57a4c0
Updated documentation to describe TLS based OAuth setup
SravanThotakura05 f262c6f
updated documentation - added tracing configuration
SravanThotakura05 1a80bcb
Updated documentation
SravanThotakura05 b69961d
Merge branch 'main' into tracing
SravanThotakura05 42a7b1e
Updated pom version of OAuth integration tests
SravanThotakura05 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
59 changes: 59 additions & 0 deletions
59
quarkus-solace-client/runtime/src/main/java/com/solace/quarkus/runtime/OidcProvider.java
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.solace.quarkus.runtime; | ||
|
||
import java.time.Duration; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.enterprise.event.Observes; | ||
import jakarta.inject.Inject; | ||
|
||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
|
||
import com.solace.messaging.MessagingService; | ||
import com.solace.messaging.config.SolaceProperties; | ||
|
||
import io.quarkus.oidc.client.OidcClient; | ||
import io.quarkus.oidc.client.Tokens; | ||
import io.quarkus.runtime.StartupEvent; | ||
import io.smallrye.mutiny.Multi; | ||
import io.smallrye.mutiny.infrastructure.Infrastructure; | ||
|
||
@ApplicationScoped | ||
public class OidcProvider { | ||
|
||
@ConfigProperty(name = "quarkus.solace.oidc.refresh.interval", defaultValue = "60s") | ||
Duration duration; | ||
|
||
@Inject | ||
OidcClient client; | ||
|
||
private volatile Tokens lastToken; | ||
private MessagingService service; | ||
|
||
Tokens getToken() { | ||
Tokens firstToken = client.getTokens().await().indefinitely(); | ||
lastToken = firstToken; | ||
return firstToken; | ||
} | ||
|
||
void init(MessagingService service) { | ||
this.service = service; | ||
} | ||
|
||
void startup(@Observes StartupEvent event) { | ||
Multi.createFrom().ticks().every(duration) | ||
.emitOn(Infrastructure.getDefaultWorkerPool()) | ||
// .filter(aLong -> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented it as we will not receive refresh token in client_credentials OAuth flow |
||
// if (lastToken.isAccessTokenWithinRefreshInterval()) { | ||
// return true; | ||
// } else | ||
// return false; | ||
// }) | ||
.call(() -> client.getTokens().invoke(tokens -> { | ||
lastToken = tokens; | ||
})) | ||
.invoke(() -> service.updateProperty(SolaceProperties.AuthenticationProperties.SCHEME_OAUTH2_ACCESS_TOKEN, | ||
lastToken.getAccessToken())) | ||
.subscribe().with(aLong -> { | ||
}); | ||
} | ||
} |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ozangunalp is there a way we can produce this bean only if oidc properties are configured by user. I see some warnings/errors thrown by oidc-client library when no configuration is available(in case of basic authentication or any other type of authentication). This is not blocking message flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the easier option is to make it do nothing when oauth authentication is not configured.