-
Notifications
You must be signed in to change notification settings - Fork 22
feat(guardian): rich consent supports authorization details #126
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(guardian): rich consent supports authorization details #126
Conversation
Add support to `authorization_details` property in the Rich Consent record.
README.md
Outdated
| } | ||
| ``` | ||
|
|
||
| Or, if you prefer to work with typed objects, you can use the filter helper passing a Class that has been annotated with `@AuthorizationDetailsType("[type]")`. |
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 we should be more forward in encouraging this as the default behaviour. See the wording that I put in the iOS README for comparison
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.
Done in c42f8b4
README.md
Outdated
| } | ||
| ``` | ||
|
|
||
| Or, if you prefer to work with typed objects, you can use the filter helper passing a Class that has been annotated with `@AuthorizationDetailsType("[type]")`. |
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 we probably need to make a reference to the GSON docs here. Whilst we don't explicitly expose any dependency on Gson objects in our inteface, our implementation is implicitly coupled to it and the types they define need to conform to the rules for deserialization (and can leverage things like their attributes for customization)
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.
Agreed, added here c42f8b4
| } | ||
|
|
||
| public String getType() { | ||
| return "payment_initiation"; |
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.
Not keen on this. I feels a bit redundant declaring this statically since we are using the annotation. I know its just an example and it ultimately will get populated to this but I think it might lead to confusion by someone using this as a reference. I'd let this be a data value like the others and let the serialization populate it.
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.
Fixed in 67ad9c8
|
|
||
| setupUI(); | ||
|
|
||
| if (notification.getTransactionLinkingId() != null) { |
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 is much nicer than having the separate activities with all the logic in Main. This can probably be tidied up a bit though but adding so private methods to reduce the nesting a bit. You also have 3 code paths that all ultimately call updateUI() - pretty sure you can simplify
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 moved fragment initialization logic bits to private methods. About the three paths calling updateUI(), I did find a bug that caused the regular authentication fragment to always be shown before fetching the rich consent record. However, because it's "async" I didn't find an easy way to simplify it. If you've got ideas I'm all ears.
The bug has been fixed in b7f56a8
| Log.e(TAG, "Error requesting consent details", e); | ||
| } | ||
| } | ||
| startActivity(NotificationActivity.getStartIntent(this, notification, enrollment)); |
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.
Much better
|
|
||
| <style name="Label.Small" parent="Label"> | ||
| <item name="android:textSize">12sp</item> | ||
| </style> |
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.
not sure it makes sense to create a style just for one TextSize attribute. Usually this approach is used when there's a need to group several elements, or when there's a design system in place. At the moment we have neither
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 now that we removed the inline text size attribute from all the views, this style makes more sense now.
| android:layout_height="wrap_content" | ||
| android:layout_marginBottom="36dp" | ||
| android:textSize="12sp" | ||
| android:theme="@style/Label" |
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.
in this case the value of android:textSize attribute isn't being used because it's overridden by next element - android:theme="@style/Label" which contains textSize = 24.
Please pick just one attribute
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginBottom="12dp" | ||
| android:textSize="12sp" |
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.
in this case the value of android:textSize attribute isn't being used because it's overridden by next element - android:theme="@style/Label" which contains textSize = 24.
Please pick just one attribute
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:text="Date" | ||
| android:textSize="12sp" |
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.
in this case textSize can be removed since the Label.Header is being used
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:text="Binding Message" | ||
| android:textSize="12sp" |
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.
in this case textSize can be removed since the Label.Header is being used
| android:layout_width="match_parent" | ||
| android:layout_height="wrap_content" | ||
| android:layout_marginBottom="12dp" | ||
| android:textSize="12sp" |
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.
in this case the value of android:textSize attribute isn't being used because it's overridden by next element - android:theme="@style/Label" which contains textSize = 24.
Please pick just one attribute
|
|
||
| layout = view.findViewById(R.id.dynamicAuthorizationDetailsLayout); | ||
| bindingMessageText = view.findViewById(R.id.bindingMessage); | ||
| dateText = view.findViewById(R.id.dateText); |
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.
for better readability it could be moved into a separate function named setupUI
| remittanceInfoText = view.findViewById(R.id.paymentRemittanceInformationText); | ||
| creditorAccountText = view.findViewById(R.id.paymentAccountText); | ||
| amountCurrencyText = view.findViewById(R.id.paymentAmountCurrencyText); | ||
| amountText = view.findViewById(R.id.paymentAmountText); |
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.
for better readability it could be moved into a separate function named setupUI
|
|
||
| bindingMessageText = (TextView) view.findViewById(R.id.bindingMessage); | ||
| scopeText = (TextView) view.findViewById(R.id.scope); | ||
| dateText = (TextView) view.findViewById(R.id.dateText); |
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.
for better readability it could be moved into a separate function named setupUI
| browserText = view.findViewById(R.id.browserText); | ||
| osText = view.findViewById(R.id.osText); | ||
| locationText = view.findViewById(R.id.locationText); | ||
| dateText = view.findViewById(R.id.dateText); |
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.
for better readability it could be moved into a separate function named setupUI
|
@SerhiiKobezaCapgemini I fixed all your requested changes. Thank you for your feedback. |
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
Add support to
authorization_detailsproperty in the Rich Consent record.Adds a demo to the sample app that accepts "payment_initiation" authorization details type and displays the details in the consent screen.
References
Testing
Checklist