Algorithm-ToNumberMunger
view release on metacpan or search on metacpan
lib/Algorithm/ToNumberMunger.pm view on Meta::CPAN
},
aad_client_app => {
numeric => 0,
map => {
# Azure AD ClientAppUsed. Numbered so the modern clients sort low
# and the legacy-auth protocols (which cannot do MFA) sort high --
# a ">= 2 means legacy auth" threshold is the feature you want.
do {
my %m = (
'browser' => 0,
'mobile apps and desktop clients' => 1,
);
my @legacy = (
'exchange activesync',
'imap4',
'pop3',
'authenticated smtp',
'smtp',
'mapi over http',
'exchange web services',
'exchange online powershell',
t/mungers.t view on Meta::CPAN
my $pt = $M->build( { munger => 'aws_principal_type_enum', default => -1 } );
is( $pt->('Root'), 0, 'aws_principal_type root (the alert signal)' );
is( $pt->('AssumedRole'), 2, 'aws_principal_type assumedrole' );
is( $pt->('IAMUser'), 1, 'aws_principal_type iamuser (case-insensitive)' );
is( $pt->('nope'), -1, 'aws_principal_type default for unlisted' );
# aad_client_app: modern < 2, legacy >= 2 (the legacy-auth threshold).
my $ca = $M->build( { munger => 'aad_client_app_enum', default => -1 } );
is( $ca->('Browser'), 0, 'aad_client_app browser is modern' );
is( $ca->('Mobile Apps and Desktop clients'), 1, 'aad_client_app modern desktop' );
ok( $ca->('IMAP4') >= 2, 'aad_client_app IMAP4 is legacy (>= 2)' );
ok( $ca->('POP3') >= 2, 'aad_client_app POP3 is legacy (>= 2)' );
is( $ca->('imap'), $ca->('IMAP4'), 'aad_client_app imap short alias' );
ok( $ca->('Browser') < 2 && $ca->('Other clients') >= 2,
'aad_client_app: modern sorts below the legacy-auth threshold' );
my $rs = $M->build( { munger => 'risk_state_enum', default => -1 } );
is( $rs->('none'), 0, 'risk_state none' );
is( $rs->('atRisk'), 4, 'risk_state atRisk (case-insensitive)' );
is( $rs->('confirmedCompromised'), 5, 'risk_state confirmedCompromised' );
( run in 1.446 second using v1.01-cache-2.11-cpan-7fcb06a456a )