How to control helplink_text in adb2c - azure-ad-b2c

I have following claimtype's as part of signup page in TrustFrameworkBase.xml,
claimtype: newPassword
<ClaimType Id="newPassword">
<DisplayName>New Password</DisplayName>
<DataType>string</DataType>
<UserHelpText>Enter new password</UserHelpText>
<UserInputType>Password</UserInputType>
<Restriction>
<Pattern RegularExpression="^((?=.*[a-z])(?=.*[A-Z])(?=.*\d)|(?=.*[a-z])(?=.*[A-Z])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*\d)(?=.*[^A-Za-z0-9])|(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]))([A-Za-z\d##$%^&*\-_+=[\]{}|\\:',?/`~"();!]|\.(?!#)){8,16}$" HelpText="8-16 characters, containing 3 out of 4 of the following: Lowercase characters, uppercase characters, digits (0-9), and one or more of the following symbols: # # $ % ^ & * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; ." />
</Restriction>
</ClaimType>
claimtype: reenterPassword
<ClaimType Id="reenterPassword">
<DisplayName>Confirm New Password</DisplayName>
<DataType>string</DataType>
<UserHelpText>Confirm new password</UserHelpText>
<UserInputType>Password</UserInputType>
<Restriction>
<Pattern RegularExpression="^((?=.*[a-z])(?=.*[A-Z])(?=.*\d)|(?=.*[a-z])(?=.*[A-Z])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*\d)(?=.*[^A-Za-z0-9])|(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]))([A-Za-z\d##$%^&*\-_+=[\]{}|\\:',?/`~"();!]|\.(?!#)){8,16}$" HelpText=" " />
</Restriction>
</ClaimType>
and in TrustFrameworkLocalization.xml
<LocalizedString ElementType="UxElement" StringId="helplink_text">
Must include at least 8-16 characters, containing 3 out of 4 of the following:
   • Upper case (A-Z)
   • Lower case (a-z)
   • Numbers (0-9)
   • One or more of the following symbols:
      • # # $ % ^ & * - _ + = \[ ] \{ } | \\ : ' , ? / ` ~ " ( ) ; .
</LocalizedString>
in the UI this helplink_text is displayed below both fields newPAssword, reenterPassword.
How to avoid this and add customized messages below each fields

Related

How to reverse the order of input and echoed input in an Android Studio 3.1.2 "Live template"?

I'm in Android Studio 3.1.2's File , Settings... , Editor , Live templates creating a new template named lgg to aid with debugging my problems with Context:
Log.w("", "<" + $VAR2$ + "> is value of [$VAR2$]");
Note that $VAR2$ occurs in two places. When I type lgg and hit tab, the cursor is positioned at the first $VAR2$ spot, like so:
Log.w("", "<" +
[]
+ "> is the value of [
] ")
As I type, for example, mContext, the second $VAR2$ spot echoes what I type, like so:
Log.w("", "<" +
mCo
+ "> is the value of [
mCo
] ")
Great! During execution, stuff like this is output (after I finish typing mContext, and other similar lines):
<com.dslomer64.sqhell.MainActivity#ca3e6b0> is the value of [mContext]
<android.view.ContextThemeWrapper#e330929> is the value of [builder.getContext()]
<android.app.AlertDialog$Builder#73b94ae> is value of [builder]
<android.widget.TextView{7c6ce5b V.ED..... ......ID 0,0-0,0}> is the value of [message]
I'd rather have the name of the object precede the value instead of value preceding object name. I'd rather have this as debugging output...
The value of [mContext] is <com.dslomer64.sqhell.MainActivity#ca3e6b0>
But in order to get the object name displayed first, it has to be inside double quotes. That is, the template would have to be ...
Log.w("", "The value of [$VAR2$] is [" + $VAR2$ + "]")
... in order to translate into ...
Log.w("", "The value of [mContext] is <" + mContext +">");
... to make the output become ...
The value of [mContext] is <com.whoever.whatever.MainActivity#ca3e6b0>
But then autocomplete is impossible.
So.
What would that template have to look like in order for the cursor to be placed here at the second $VAR2$ ...
Log.w("", "<" +
+ "> is the value of [
[]
] ")
... with the echoing of typing occurring in the first $VAR2$?

Password Validation on Azure B2C SignUp

We are using Custom SignUp/SignIn policy and have not changed any of the microsoft provided attributes and their rules.
For the password, validation is not working as per given in the policy
<ClaimType Id="newPassword">
<DisplayName>New Password</DisplayName>
<DataType>string</DataType>
<UserHelpText>Enter new password</UserHelpText>
<UserInputType>Password</UserInputType>
<Restriction>
<Pattern RegularExpression="^((?=.*[a-z])(?=.*[A-Z])(?=.*\d)|(?=.*[a-z])(?=.*[A-Z])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*\d)(?=.*[^A-Za-z0-9])|(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]))([A-Za-z\d##$%^&*\-_+=[\]{}|\\:',?/`~"();!]|\.(?!#)){8,16}$" HelpText="8-16 characters, containing 3 out of 4 of the following: Lowercase characters, uppercase characters, digits (0-9), and one or more of the following symbols: # # $ % ^ & * - _ + = [ ] { } | \ : ' , ? / ` ~ " ( ) ; ." />
</Restriction>
</ClaimType>
If I start to enter password in the textbox, it will display this Helptext as mentioned above but when I enter the password as "testT1234" and proceed, it is not enforcing the validation.
Please let me know if I have to add/update the custom policy to enforce what being said is implemented.
Thanks,
As per Regex and helptext, your given password "tesT1234" is matching fine.
I guess you understood differently and also kept thinking it should allow special character(s) to complete the password match.
As per regex & helptext: if your password satisfies 3 out of 4 conditions, B2C allows you to use that password. Your given password already met 3 conditions.
8-16 characters, containing 3 out of 4 of the following: Lowercase characters, uppercase characters, digits (0-9), and one or more of the following symbols:
You can happily tweak the regex and add your own match criteria.

What does it mean?

string query = "SELECT *
FROM users
WHERE username = "'" + username + "'
AND password = '" + password + "'";
Since this query is constructed by concatenating an input string directly from the user, the query behaves correctly only if password does not contain a single-quote character. If the user enters
__"
joe
"
as the username and
"
example' OR
'a'='a
as the password, the resulting query
becomes__
I want to know what the single quote character means

INVALID_TOKEN_FORMAT

I am just looking into integration options and have setup a dev account and am working on the basic login_information endpoint. I have followed the documentation and tried using the XML and JSON options when setting the headers.
Both return the same message:
XML:
<errorCode>INVALID_TOKEN_FORMAT</errorCode>
<message>The security token format does not conform to expected schema.</message>
JSON:
{
"errorCode": "INVALID_TOKEN_FORMAT",
"message": "The security token format does not conform to expected schema."
}
I have made another token and tried that, I have also checked that there is no backslash (\) character in my password. I have tried with the API Username and my email address. The Tokens both have 32 characters and 4 (-) and are being submitted as utf8.
The XML GET:
Headers:
BE_HTTP_Set_Custom_Header (
"X-DocuSign-Authentication:" ;
"<DocuSignCredentials>
<IntegratorKey>" & integrator_key & "</IntegratorKey>
<Username>” & username & ”</Username>
<Password>” & password & ”</Password>
</DocuSignCredentials>"
)
Where the quote data e.g. “ & integrator_key & “ is pulling the data from the database.
BE_HTTP_Set_Custom_Header ( "Content-Type" ; "application/xml" )
GET:
BE_GetURL (
"https://demo.docusign.net/restapi/v2/login_information?api_password=true&include_account_id_guid=true&login_settings=all" ; "" )
The JSON GET:
Headers:
BE_HTTP_Set_Custom_Header (
"X-DocuSign-Authentication:" ;
"{
\"Username\":\"” & username & ”\",
\"Password\":\"” & password & ”\",
\"IntegratorKey\":\"" & integrator_key & "\"
}"
)
Where the quoted data e.g. “ & integrator_key & “ is pulling the data from the database, here I need to escape the " of the JSON with the \ e.g. \".
BE_HTTP_Set_Custom_Header ( "Content-Type" ; "application/json" )
GET:
BE_GetURL (
"https://demo.docusign.net/restapi/v2/login_information" ; "" )
The login_information method is used to obtain information about a user only when you're using Legacy Authentication.
You should first decide if you're writing a User App (where the user will be present to authenticate herself) or a Service Integration that will run autonomously in the background.
Then use the appropriate authentication.
A beta recipe that demonstrates both authentication models.
Added
Check that your password doesn't include a reserved XML character that needs to be escaped. < and & need to be replaced with the appropriate entity sequence.
And try authenticating with your email, pw, and integration key via the recipe referenced above. If it works, then the problem is in your code. If it doesn't work then something's wrong with your credentials.
Also, check that when you add an http header that you should include the colon with the header key value.

How can I repeatedly match from A until B in VIM?

I need to get all text between <Annotation> and </Annotation>, where a word MATCH occurs. How can I do it in VIM?
<Annotation about="MATCH UNTIL </Annotation> " timestamp="0x000463e92263dd4a" href=" 5raS5maS90ZWh0YXZha29rb2VsbWEvbGFza2FyaS8QyrqPk5L9mAI">
<Label name="las" />
<Label name="_cse_6sbbohxmd_c" />
<AdditionalData attribute="original_url" value="MATCH UNTIL </Annotation> " />
</Annotation>
<Annotation about="NO MATCH" href=" Cjl3aWtpLmhlbHNpbmtpLmZpL2Rpc3BsYXkvbWF0aHN0YXRLdXJzc2l0L0thaWtraStrdXJzc2l0LyoQh_HGoJH9mAI">
<Label name="_cse_6sbbohxmd_c" />
<Label name="courses" />
<Label name="kurssit" />
<AdditionalData attribute="original_url" value="NO MATCH" />
</Annotation>
<Annotation about="MATCH UNTIL </ANNOTATION> " score="1" timestamp="0x000463e90f8eed5c" href="CiZtYXRoc3RhdC5oZWx zaW5raS5maS90ZWh0YXZha29rb2VsbWEvKhDc2rv8kP2YAg">
<Label name="_cse_6sbbohxmd_c" />
<Label name="exercises_without_solutions" />
<Label name="tehtäväkokoelma" />
<AdditionalData attribute="original_url" value="MATCH UNTIL </ANNOTATION>" />
</Annotation>
First, a disclaimer: Any attempt to slice and dice XML with regular expressions is fragile; a real XML parser would do better.
The pattern:
\(<Annotation\(\s*\w\+="[^"]\{-}"\s\{-}\)*>\)\#<=\(\(<\/Annotation\)\#!\_.\)\{-}"MATCH\_.\{-}\(<\/Annotation>\)\#=
Let's break it down...
Group 1 is <Annotation\(\s*\w\+="[^"]\{-}"\s\{-}\)*>. It matches the start-tag of the Attribute element. Group 2, which is embedded in Group 1, matches an attribute and may be repeated 0 or more times.
Group 2 is \s*\w\+="[^"]\{-}"\s\{-}. Most of these pieces are commonly used; the most unusual is \{-}, which means non-greedy repetition (*? in Perl-compatible regular expressions). The non-greedy whitespace match at the end is important for performance; without it, Vim will try every possible way to split the whitespace between attributes between the \s* at the end of Group 2 and the \s* at the beginning of the next occurrence of Group 2.
Group 1 is followed by \#<=. This is a zero-width positive look-behind. It prevents the start-tag from being included in the matched text (e.g., for s///).
Group 3 is \(<\/Annotation\)\#!\_.. It includes Group 4, which matches the beginning of the Attribute end-tag. The \#! is a zero-width negative look-ahead and \_. matches any character (including newlines). Together, this groups matches at any character except where the Attribute end-tag starts. Group 3 is followed by a non-greedy repetition marker \{-} so that it matches the smallest block of text before MATCH. If you were to use \_. instead of Group 3, the matched text could include the end-tag of an Annotation element that did not include MATCH and continue through into the next Annotation element with MATCH. (Try it.)
The next bit is straightforward: Find MATCH and a minimal number of other characters before the end-tag.
Group 5 is easy: It's the end tag. \#= is a zero-width positive look-ahead, which is included here for the same reason as the \#<= for the start-tag. We have to repeat <\/Attribute rather than use \4 because groups with zero-width modifiers aren't captured.
Does it have to be done within vim? Could you cheat, and open a second window where you pipe something into more/less that tells you what line number to go to within vim?
-- edit --
I have never done a multi-line match/search in vi[m]. However, to cheat in another window:
perl -n -e 'if ( /<tag/ .. /<\/tag/)' -e '{ print "$.:$_"; }' file.xml | less
will show the elements/blocks for "tag" (or other longer matching names), with line numbers, in less, and you can then search for the other text within each block.
Close enough?
-- edit --
within "less", type
/MATCH
to search for occurrences of MATCH. On the left margin will be the line number where that instance (within the targeted element/tags) is.
within vi[m], type
:n
where "n" is the desired line number.
Of course, if what you really wanted to do was some kind of search/yank/replace, it's more complicated. At that point, awk / perl / ruby (or something similar which meets your tastes ... or xsl?) is really the tool you should be using for the transformation.

Resources