Skip to content
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

Charm pam module #15

Merged
merged 18 commits into from
Aug 10, 2023
Merged

Charm pam module #15

merged 18 commits into from
Aug 10, 2023

Conversation

didrocks
Copy link
Member

@didrocks didrocks commented Aug 9, 2023

We move from a purely declarative and linear approach to a more modular
react-like (elm) model.
Those models are nested, and can display some UIs.
Transitioning between models are done via an event based system

didrocks and others added 4 commits August 9, 2023 15:28
We move from a purely declarative and linear approach to a more modular
react-like (elm) model.
Those models are nested, and can display some UIs.
Transitioning between models are done via an event based system

Co-authored-by: Jean-Baptiste Lallement <[email protected]>
The button now reselect the authentication method to triggers new sms
send and other side effect.

For elements with wait: true, then, IsAuthorized is cancelled, UI is
recreated and IsAuthorized() is called again.

Migrate any potential text input fields while the layout is redrawn.

Co-authored-by: Jean-Baptiste Lallement <[email protected]>
As we can build it, ensure we don’t commit it by mistake.

Co-authored-by: Jean-Baptiste Lallement <[email protected]>
This avoids any potential segfaults when trying to draw the view.

Co-authored-by: Jean-Baptiste Lallement <[email protected]>
@didrocks didrocks requested a review from a team as a code owner August 9, 2023 15:18
didrocks and others added 12 commits August 9, 2023 18:24
Keep a TODO to maybe remove it by using the list selection item index.
We were returning the struct content beforehand.
Any other elements would be a programming error, hence panicing as this
should be caught by tests.
Make the focused button readable.
Now that the CLI supports it, it’s interesting to set it.
Consequence select call will change temporary code or qr code. This is
to simulate and demonstrate sms resends and so on.
Co-authored-by: Jean-Baptiste Lallement <[email protected]>
Copy link
Member

@denisonbarbosa denisonbarbosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a minor comment about the responses that we are using.

if err != nil {
if st := status.Convert(err); st.Code() == codes.Canceled {
return isAuthorizedResultReceived{
access: "cancelled",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better to use responses.AuthCancelled instead? Otherwise, it might break if we decide to switch the access message.

Didn't add a suggestion because it would require import fixes as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can’t here, because as we cancel the context, there is no access to the "access" field (the struct is nil). However, I agree, we can resend responses.AuthCancelled.
Will change that.

Comment on lines 113 to 130
case "allowed":
return *m, sendEvent(pamSuccess{})

case "retry":
m.errorMsg = dataToMsg(msg.data)
return *m, sendEvent(startAuthorization{})

case "denied":
errMsg := "Access denied"
if err := dataToMsg(msg.data); err != "" {
errMsg = err
}
return *m, sendEvent(pamAuthError{msg: errMsg})

case "next":
return *m, sendEvent(GetAuthenticationModesRequested{})

case "cancelled":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment on the access values here

@didrocks
Copy link
Member Author

Just pushed 2 extra commits with the new response types and plugging them into PAM. Want to have another look?

@didrocks didrocks merged commit b2ee542 into main Aug 10, 2023
3 checks passed
@didrocks didrocks deleted the charm_pam_module branch August 10, 2023 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants