@@ -91,7 +91,7 @@ private enum Action {
91
91
module .argMap .get ("user-name" )
92
92
).mput (
93
93
Authn .InvokeKeys .CREDENTIALS ,
94
- getPassword ((String )module .argMap .get ("password" ))
94
+ getPassword ((String ) module .argMap .get ("password" ))
95
95
)
96
96
);
97
97
log .info (
@@ -113,13 +113,13 @@ private enum Action {
113
113
),
114
114
CHANGE_CREDENTIALS (
115
115
module -> {
116
- AAAProfile aaaprofile = module .new AAAProfile ((String )module .argMap .get ("profile" ));
116
+ AAAProfile aaaprofile = module .new AAAProfile ((String ) module .argMap .get ("profile" ));
117
117
if ((aaaprofile .getAuthnExtension ().getContext ().<Long >get (Authn .ContextKeys .CAPABILITIES , 0L ) & Authn .Capabilities .CREDENTIALS_CHANGE ) == 0 &&
118
- !(Boolean )module .argMap .get ("ignore-capabilities" )) {
118
+ !(Boolean ) module .argMap .get ("ignore-capabilities" )) {
119
119
throw new IllegalArgumentException ("Unsupported operation: CREDENTIALS_CHANGE" );
120
120
}
121
121
122
- String user = aaaprofile .mapUser ((String )module .argMap .get ("user-name" ));
122
+ String user = aaaprofile .mapUser ((String ) module .argMap .get ("user-name" ));
123
123
log .info ("API: -->Authn.InvokeCommands.CREDENTIALS_CHANGES profile='{}' user='{}'" , aaaprofile .getProfile (), user );
124
124
ExtMap outMap = aaaprofile .getAuthnExtension ().invoke (
125
125
new ExtMap ().mput (
@@ -130,10 +130,10 @@ private enum Action {
130
130
user
131
131
).mput (
132
132
Authn .InvokeKeys .CREDENTIALS ,
133
- getPassword ((String )module .argMap .get ("password" ))
133
+ getPassword ((String ) module .argMap .get ("password" ))
134
134
).mput (
135
135
Authn .InvokeKeys .CREDENTIALS_NEW ,
136
- getPassword ((String )module .argMap .get ("password-new" ), "New password: " )
136
+ getPassword ((String ) module .argMap .get ("password-new" ), "New password: " )
137
137
)
138
138
);
139
139
log .info (
@@ -151,8 +151,8 @@ private enum Action {
151
151
),
152
152
LOGIN_USER (
153
153
module -> {
154
- AAAProfile aaaprofile = module .new AAAProfile ((String )module .argMap .get ("profile" ));
155
- String user = aaaprofile .mapUser ((String )module .argMap .get ("user-name" ));
154
+ AAAProfile aaaprofile = module .new AAAProfile ((String ) module .argMap .get ("profile" ));
155
+ String user = aaaprofile .mapUser ((String ) module .argMap .get ("user-name" ));
156
156
log .info ("API: -->Authn.InvokeCommands.AUTHENTICATE_CREDENTIALS profile='{}' user='{}'" , aaaprofile .getProfile (), user );
157
157
ExtMap outMap = aaaprofile .getAuthnExtension ().invoke (
158
158
new ExtMap ().mput (
@@ -163,7 +163,7 @@ private enum Action {
163
163
user
164
164
).mput (
165
165
Authn .InvokeKeys .CREDENTIALS ,
166
- getPassword ((String )module .argMap .get ("password" ))
166
+ getPassword ((String ) module .argMap .get ("password" ))
167
167
)
168
168
);
169
169
log .info (
@@ -192,7 +192,7 @@ private enum Action {
192
192
);
193
193
}
194
194
195
- if (aaaprofile .getMappingExtension () != null ) {
195
+ if (aaaprofile .getMappingExtension () != null ) {
196
196
log .info ("API: -->Mapping.InvokeCommands.MAP_AUTH_RECORD" );
197
197
Dump .AUTH_RECORD .dump (module , authRecord );
198
198
authRecord = aaaprofile .getMappingExtension ().invoke (
@@ -302,7 +302,7 @@ private enum Action {
302
302
SEARCH (
303
303
module -> {
304
304
ExtensionProxy authzExtension = module .getExtensionsManager ().getExtensionByName ((String ) module .argMap .get ("extension-name" ));
305
- ExtUUID entity = getQueryEntity ((String )module .argMap .get ("entity" ));
305
+ ExtUUID entity = getQueryEntity ((String ) module .argMap .get ("entity" ));
306
306
ExtMap filter = createQueryFilter (entity , module .argMap );
307
307
Dump .QUERY_FILTER_RECORD .dump (module , filter , "" );
308
308
@@ -311,7 +311,7 @@ private enum Action {
311
311
Collections .<String >emptyList ()
312
312
);
313
313
if (module .argMap .get ("namespace" ) != null ) {
314
- namespaces = (Collection <String >)module .argMap .get ("namespace" );
314
+ namespaces = (Collection <String >) module .argMap .get ("namespace" );
315
315
}
316
316
317
317
for (String namespace : namespaces ) {
@@ -325,7 +325,7 @@ private enum Action {
325
325
entity
326
326
).mput (
327
327
Authz .InvokeKeys .QUERY_FLAGS ,
328
- getAuthzFlags ((List <String >)module .argMap .get ("authz-flag" ))
328
+ getAuthzFlags ((List <String >) module .argMap .get ("authz-flag" ))
329
329
).mput (
330
330
Authz .InvokeKeys .QUERY_FILTER ,
331
331
filter
@@ -395,12 +395,12 @@ Map<String, Object> parse(Map<String, String> substitutions, Properties props, L
395
395
parser .parse (actionArgs );
396
396
Map <String , Object > argMap = parser .getParsedArgs ();
397
397
398
- if ((Boolean )argMap .get ("help" )) {
398
+ if ((Boolean ) argMap .get ("help" )) {
399
399
System .out .format ("Usage: %s" , parser .getUsage ());
400
400
throw new ExitException ("Help" , 0 );
401
401
}
402
- if (!parser .getErrors ().isEmpty ()) {
403
- for (Throwable t : parser .getErrors ()) {
402
+ if (!parser .getErrors ().isEmpty ()) {
403
+ for (Throwable t : parser .getErrors ()) {
404
404
log .error (t .getMessage ());
405
405
}
406
406
throw new ExitException ("Parsing error" , 1 );
@@ -492,7 +492,7 @@ private static void dumpRecord(AAAServiceImpl module, ExtMap extMap, Set<ExtKey>
492
492
Collection <ExtKey > keys = new HashSet <>(extMap .keySet ());
493
493
if (module .argModuleMap .get ("key" ) != null ) {
494
494
Collection <ExtKey > k = new HashSet <>();
495
- for (String uuid : (List <String >)module .argModuleMap .get ("key" )) {
495
+ for (String uuid : (List <String >) module .argModuleMap .get ("key" )) {
496
496
k .add (new ExtKey ("Unknown" , Object .class , uuid ));
497
497
}
498
498
keys .retainAll (k );
@@ -505,7 +505,7 @@ private static void dumpRecord(AAAServiceImpl module, ExtMap extMap, Set<ExtKey>
505
505
continue ;
506
506
}
507
507
module .output (
508
- ((String )module .argModuleMap .get ("format" )).replace (
508
+ ((String ) module .argModuleMap .get ("format" )).replace (
509
509
"{key}" ,
510
510
key .getUuid ().getUuid ().toString ()
511
511
).replace (
@@ -540,7 +540,7 @@ private static <T> List<T> safeList(List<T> list) {
540
540
}
541
541
542
542
private ExtensionsManager getExtensionsManager () {
543
- return (ExtensionsManager )context .get (ContextKeys .EXTENSION_MANAGER );
543
+ return (ExtensionsManager ) context .get (ContextKeys .EXTENSION_MANAGER );
544
544
}
545
545
546
546
private ExtensionProxy getExtensionByProfile (String name ) {
@@ -554,7 +554,7 @@ private ExtensionProxy getExtensionByProfile(String name) {
554
554
private ExtensionProxy getExtensionByConfigKey (String key , String value ) {
555
555
ExtensionProxy ret = null ;
556
556
557
- for (ExtensionProxy proxy : getExtensionsManager ().getExtensionsByService (Authn .class .getName ())) {
557
+ for (ExtensionProxy proxy : getExtensionsManager ().getExtensionsByService (Authn .class .getName ())) {
558
558
if (
559
559
value .equals (
560
560
proxy .getContext ().<Properties >get (
@@ -591,7 +591,7 @@ private static String getPassword(String what, String prompt) {
591
591
if ("pass" .equals (type )) {
592
592
password = value ;
593
593
} else if ("file" .equals (type )) {
594
- try (
594
+ try (
595
595
InputStream is = new FileInputStream (value );
596
596
Reader reader = new InputStreamReader (is , StandardCharsets .UTF_8 );
597
597
BufferedReader breader = new BufferedReader (reader )
@@ -652,12 +652,12 @@ public void parseArguments(List<String> args) throws Exception {
652
652
parser .parse (args );
653
653
argModuleMap = parser .getParsedArgs ();
654
654
655
- if ((Boolean )argModuleMap .get ("help" )) {
655
+ if ((Boolean ) argModuleMap .get ("help" )) {
656
656
System .out .format ("Usage: %s" , parser .getUsage ());
657
657
throw new ExitException ("Help" , 0 );
658
658
}
659
- if (!parser .getErrors ().isEmpty ()) {
660
- for (Throwable t : parser .getErrors ()) {
659
+ if (!parser .getErrors ().isEmpty ()) {
660
+ for (Throwable t : parser .getErrors ()) {
661
661
log .error (t .getMessage ());
662
662
}
663
663
throw new ExitException ("Parsing error" , 1 );
@@ -670,7 +670,7 @@ public void parseArguments(List<String> args) throws Exception {
670
670
671
671
try {
672
672
action = Action .valueOf (args .get (0 ).toUpperCase ().replace ("-" , "_" ));
673
- } catch (IllegalArgumentException e ) {
673
+ } catch (IllegalArgumentException e ) {
674
674
log .error ("Invalid action '{}'" , args .get (0 ));
675
675
throw new ExitException ("Invalid action" , 1 );
676
676
}
@@ -680,7 +680,7 @@ public void parseArguments(List<String> args) throws Exception {
680
680
681
681
@ Override
682
682
public void run () throws Exception {
683
- int iterations = (Integer )argModuleMap .get ("iterations" );
683
+ int iterations = (Integer ) argModuleMap .get ("iterations" );
684
684
for (int i = 0 ; i < iterations ; i ++) {
685
685
log .info ("Iteration: {}" , i );
686
686
action .execute (this );
@@ -699,7 +699,7 @@ private static ExtMap createQueryFilter(ExtUUID entity, Map<String, Object> argM
699
699
);
700
700
}
701
701
702
- for (String id : safeList ((List <String >)argMap .get ("entity-id" ))) {
702
+ for (String id : safeList ((List <String >) argMap .get ("entity-id" ))) {
703
703
filter .add (
704
704
createQueryFilterElement (
705
705
Authz .QueryEntity .GROUP .equals (entity ) ? Authz .GroupRecord .ID : Authz .PrincipalRecord .ID ,
@@ -733,7 +733,7 @@ private static ExtMap createQueryFilterElement(ExtKey key, String value) {
733
733
);
734
734
}
735
735
736
- private static ExtUUID getQueryEntity (String entity ) {
736
+ private static ExtUUID getQueryEntity (String entity ) {
737
737
try {
738
738
return (ExtUUID ) Authz .QueryEntity .class .getDeclaredField (
739
739
entity .toUpperCase ()
@@ -748,7 +748,7 @@ private static int getAuthzFlags(List<String> flags) {
748
748
for (String f : safeList (flags )) {
749
749
try {
750
750
ret |= Authz .QueryFlags .class .getDeclaredField (f .toUpperCase ().replace ("-" , "_" )).getInt (new Authz .QueryFlags ());
751
- } catch (NoSuchFieldException | IllegalAccessException ex ) {
751
+ } catch (NoSuchFieldException | IllegalAccessException ex ) {
752
752
log .error ("Unknown Authz flag '{}' (ignored)" , f );
753
753
}
754
754
}
@@ -842,7 +842,7 @@ public AAAProfile(String profile) {
842
842
this .authnName = this .authnExtension .getContext ().get (Base .ContextKeys .INSTANCE_NAME );
843
843
844
844
this .authzExtension = getExtensionsManager ().getExtensionByName (authzName );
845
- if (this .mappingName != null ) {
845
+ if (this .mappingName != null ) {
846
846
this .mappingExtension = getExtensionsManager ().getExtensionByName (mappingName );
847
847
}
848
848
@@ -856,7 +856,7 @@ public AAAProfile(String profile) {
856
856
}
857
857
858
858
public String mapUser (String user ) {
859
- if (getMappingExtension ()!= null ) {
859
+ if (getMappingExtension () != null ) {
860
860
log .info ("API: -->Mapping.InvokeCommands.MAP_USER profile='{}' user='{}'" , getProfile (), user );
861
861
user = getMappingExtension ().invoke (
862
862
new ExtMap ().mput (
0 commit comments