-
Notifications
You must be signed in to change notification settings - Fork 7
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
Auth + config file support #86
Merged
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,7 @@ | |
# vendor/ | ||
|
||
mocks/ | ||
|
||
# Generated during testing | ||
cocli/cocli | ||
cocli/cmd/output.cbor |
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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
package cmd | ||
|
||
import "github.com/veraison/apiclient/common" | ||
import ( | ||
"github.com/veraison/apiclient/auth" | ||
"github.com/veraison/apiclient/common" | ||
) | ||
|
||
type ISubmitter interface { | ||
Run([]byte, string) error | ||
SetClient(client *common.Client) error | ||
SetAuth(a auth.IAuthenticator) | ||
SetSubmitURI(uri string) error | ||
SetDeleteSession(session bool) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This file contains example configuration for connecting to Veraison services. | ||
# This configuration is only necessary for the `cocli corim submit` sub-command, | ||
# as that is the only instance where remote service configuration is used. You | ||
# do not need this configuration for creating or manipulating corims/corim and | ||
# related objects locally. | ||
|
||
# API Server submit endpoint URL. | ||
api_server: https://veraison.example/endorsement-provisioning/v1/submit | ||
|
||
# Authentication method used by the remote service. | ||
auth: none # may also be "basic" or "oauth2" | ||
|
||
# Credentials for the remote service. | ||
username: example_user # used only if auth is "basic" or "oauth2" | ||
password: Passw0rd! # used only if auth is "basic" or "oauth2"; this can also | ||
# be specfied on the command line using --password, or by | ||
# setting COCLI_PASSWORD environment variable | ||
|
||
# OAuth2 cofiguration for the authorisation server associated with the remote | ||
# service. | ||
client_id: veraison-client # used only if auth is "oauth2" | ||
client_secret: YifmabB4cVSPPtFLAmHfq7wKaEHQn10Z # used only if auth is "oauth2" | ||
token_url: http://localhost:11111/realms/veraison/protocol/openid-connect/token # used only if auth is "oauth2" | ||
|
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.
Just a question here, more than a comment.
Does the
cocli
configuration, in any way needs to be synchronised with theequivalent configuration on the services and apiclient side?
Specifically my question originates from the following line 11 on the config file:
( auth: none)
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.
Also it would be good to specify what is the default
cocli
behaviour!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.
This configuration is used to configure the
apiclient
so no synchronisation needed, as such, for that. The configuration for cocli does need to match the corresponding configuration for the service it is contacting.The default is set in the example config, and is specified in the help for the corresponding flag (when you do
cocli corim submit -h
).