Skip to content

Conversation

@cgcladeraokta
Copy link
Contributor

@cgcladeraokta cgcladeraokta commented Feb 13, 2025

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_details property 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.

Screenshot 2025-02-27 at 10 29 25 Screenshot 2025-02-27 at 10 29 25

References

Include any links supporting this change such as a:

  • GitHub Issue/PR number addressed or fixed
  • Auth0 Community post
  • StackOverflow post
  • Support forum thread
  • Related pull requests/issues from other repos

If there are no references, simply delete this section.

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (language/platform/browser version).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not the default branch

@cgcladeraokta cgcladeraokta changed the title feat(rich-consents): support authorization details feat(guardian): rich consents supports authorization details Feb 18, 2025
@cgcladeraokta cgcladeraokta changed the title feat(guardian): rich consents supports authorization details feat(guardian): rich consent supports authorization details Feb 18, 2025
@cgcladeraokta cgcladeraokta marked this pull request as ready for review February 18, 2025 12:45
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]")`.
Copy link
Contributor

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

Copy link
Contributor Author

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]")`.
Copy link
Contributor

@sam-muncke sam-muncke Feb 26, 2025

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)

Copy link
Contributor Author

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";
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

@sam-muncke sam-muncke Feb 26, 2025

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

Copy link
Contributor Author

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));
Copy link
Contributor

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>
Copy link
Contributor

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

Copy link
Contributor Author

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"
Copy link
Contributor

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"
Copy link
Contributor

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"
Copy link
Contributor

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"
Copy link
Contributor

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"
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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

@cgcladeraokta
Copy link
Contributor Author

@SerhiiKobezaCapgemini I fixed all your requested changes. Thank you for your feedback.

@cgcladeraokta cgcladeraokta requested a review from sam-muncke March 6, 2025 13:01
@ionutmanolache-okta ionutmanolache-okta merged commit 8e83c0f into auth0:master Mar 12, 2025
3 checks passed
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.

4 participants