Googleアナリティクス

2018年4月17日火曜日

Create Passwords using LogicFlow

Original Post is here.

For some reason I created LogicFlow to register accounts. However, there was a problem of what to do with the initial password. Although it seems likely to go easy without using Azure Functions, I decided to do it with Logic Apps.

I created this time at Github . Deployment buttons are also installed, so please deploy to your environment and try it.

When generating a password, it is about "usable characters". For Azure Active Directory, English uppercase letters, numbers, and some symbols are available . You need to select characters randomly.

CreatePassFlow

I created LogicFlow with this kind of feeling.(

image

First calculate the variable that sets the generation result and the required number of digits (this time is 8 to 16 letters). Here we are using the range function so that the point is "the number of elements of array = the number of digits required". The reason will be described later.

image

Next let us set the available characters for each type. At this time, when setting a numeric character string of 0 to 9, it will be recognized as "numerical value" as it is, so make it as a character string explicitly with the string function.

image

Extract a character string that becomes a password one character at a time. Randomize which character type to use, and branch it with Switch.

image

In each case, we extract one character from the first available character string. It is OK if you specify as below.

substring(outputs('Target_Strings'),rand(0,length(outputs('Target_Strings'))),1)

From the character string to be extracted, the position is randomly determined between 0 and the number of digits of the extraction target character string, and one character is extracted. If you write like this, you do not need to fix this even if more characters are available.

image

The results of the last extraction are combined and used as the generation result.

Although it is a combination of such simple processing as a whole, there is one point of attention when doing it on LogicFlow. We set the required number of digits as an array variable at the beginning, because there is a reason to be a ForEach loop.

In case of using another loop, Do-Until, I think to think of how to set the number of digits to the variable used as a counter and subtract it by 1 in the loop. However, LogicFlow 's Do - Until loop is "asynchronous and parallel operation". What happens is that multiple simultaneous processing behaves as if the value of the motion counter is not correctly subtracted. It is multithread behavior itself. Furthermore, the Do-Until loop does not have an option to operate sequentially. It always works in multi. Do-Until loop was operating correctly sequentially. I can not reproduce it, but I assume it was not there.

There are circumstances like this and we adopted a way to express the number of digits in an array to repeat with ForEach. In addition, since it is not checked whether the generated password meets the requirement of complexity, it must be determined by the caller.

0 件のコメント:

コメントを投稿