-
Notifications
You must be signed in to change notification settings - Fork 8
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
Charm pam module #15
Conversation
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]>
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]>
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.
Looks great! Just a minor comment about the responses that we are using.
pam/authorization.go
Outdated
if err != nil { | ||
if st := status.Convert(err); st.Code() == codes.Canceled { | ||
return isAuthorizedResultReceived{ | ||
access: "cancelled", |
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.
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.
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.
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.
pam/authorization.go
Outdated
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": |
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.
Same comment on the access
values here
Just pushed 2 extra commits with the new response types and plugging them into PAM. Want to have another look? |
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