question

RahulKapoor-7882 avatar image
0 Votes"
RahulKapoor-7882 asked ·

Validating Client and Tenant ID using Regular expression || MSAL4J

Hi
I am using confidential Client Application object for fetching access token. I want to validate the client id and tenant id using regular expression. I am unable to find a valid document which explains the pattern for both.
Kindly help in the issue

I am using the below regex for matching client ID -
^[a-zA-Z0-9-]+$" -> This is for Alphanumeric characters with Hypen symbol also.


ConfidentialClientApplication app = ConfidentialClientApplication
.builder(<CLIENT-ID>, ClientCredentialFactory.createFromCertificate(certificate, ""))
.authority(https://login.microsoftonline.com/<TENANT-ID>/v2.0).build();

azure-ad-msalazure-ad-libraries
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I couldn't find an existing guide so I reached out to the product team to check.

1 Vote 1 ·
RahulKapoor-7882 avatar image RahulKapoor-7882 MarileeTurscak-MSFT ·

Okay. Please let me know about it. Thanku:)

0 Votes 0 ·

1 Answer

MarileeTurscak-MSFT avatar image
0 Votes"
MarileeTurscak-MSFT answered ·

The regex validation for client id should be the same implementation as for any other input string validations, like passwords, emails etc.

As of now, unfortunately there is no official document which talks about how to specifically do text validation for this scenario. Refer to this github issue.

For these kind of validations, custom policies or jquery validations can be helpful. Have a look at this document for claims schema pattern details for validations.

General documents are available here - doc1, doc2, Stack Overflow post. You can also refer to this as an example.

Also, I am unsure from this description if you are having a particular issue or if you are mainly just looking for documentation for implementing the validation. Please share the details of the error/issue, if you are facing any.


· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@RahulKapoor-7882,

I just wanted to check in and see if you had any other questions or if you were able to resolve this issue?

If you have any other questions, please let me know.

Thank you for your time and patience throughout this issue.


Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

0 Votes 0 ·