-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: read device.id from credentials.toml when basic auth mode #3242
base: main
Are you sure you want to change the base?
feat: read device.id from credentials.toml when basic auth mode #3242
Conversation
Signed-off-by: Rina Fujino <rina.fujino.23@gmail.com>
8c5a53c
to
6ba5896
Compare
Codecov ReportAttention: Patch coverage is Additional details and impacted files📢 Thoughts on this report? Let us know! |
Why don't we permanently switch this setting to
If someone consciously sets |
Since both Proposal 1:
If tedge config macro has Probably the #[tedge_config(try_from(
error = "\
The device id is read from the device certificate if it exists.\n\
To create a device certificate, you can use `tedge cert create --device-id <id>`.",
function = "device_id",
))]
#[tedge_config(example = "Raspberrypi-4d18303a-6d3a-11eb-b1a6-175f6bb72665")]
#[tedge_config(note = "This setting is derived from the device certificate if it is set.")]
#[doku(as = "String")]
id: Result<String, ReadError>, Proposal 2:
Since it removes the block for the inconsistency of the certificate's CN and the value of
The code can look like below. #[tedge_config(note ="\
The device id is read from the device certificate if it exists.\n\
To create a device certificate, you can use `tedge cert create --device-id <id>`."
)]
#[tedge_config(default(function = "device_id")]
#[tedge_config(example = "Raspberrypi-4d18303a-6d3a-11eb-b1a6-175f6bb72665")]
#[doku(as = "String")]
id: String, |
I'd go with proposal 2, as that is sounds straightforward. If someone has explicitly set a value using |
Things are already too complicated and both proposals are only making things more complicated. I do think we must stop reading the device id from the certificate:
This is the key. I propose to:
|
Adding a bit of further detail to Didier's proposed solution as we discussed, we'll need to gracefully handle cases where the device ID isn't explicitly set. This can be done by setting |
Proposed changes
Draft for further discussion.
c8y.auth_mode
. This PR proposes to keepdevice_id
in thecredentials.toml
file alternatively.c8y
requires a profile name. However, it cannot be determined whentedge config get device.id
is called. I parsedNone
as the device profile. Correct me if I am wrong.Types of changes
Paste Link to the issue
#3240
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments