From e5c77b3fbe72f9fc488e29f25582c04277660d36 Mon Sep 17 00:00:00 2001
From: Martin Holder <30836601+mhldr@users.noreply.github.com>
Date: Wed, 14 Oct 2020 10:29:01 +0100
Subject: [PATCH] Revert "add security.appbnd_test from CL to OL"
---
.../.classpath | 6 -
.../.gitignore | 2 -
dev/com.ibm.ws.security.appbnd_test/.project | 23 -
.../org.eclipse.core.resources.prefs | 4 -
.../.settings/org.eclipse.jdt.core.prefs | 286 -----
dev/com.ibm.ws.security.appbnd_test/bnd.bnd | 53 -
.../AppBndAuthorizationTableServiceTest.java | 1127 -----------------
.../DefaultDelegationProviderTest.java | 222 ----
.../delegation/SecurityRolesBuilder.java | 94 --
9 files changed, 1817 deletions(-)
delete mode 100644 dev/com.ibm.ws.security.appbnd_test/.classpath
delete mode 100644 dev/com.ibm.ws.security.appbnd_test/.gitignore
delete mode 100644 dev/com.ibm.ws.security.appbnd_test/.project
delete mode 100644 dev/com.ibm.ws.security.appbnd_test/.settings/org.eclipse.core.resources.prefs
delete mode 100644 dev/com.ibm.ws.security.appbnd_test/.settings/org.eclipse.jdt.core.prefs
delete mode 100644 dev/com.ibm.ws.security.appbnd_test/bnd.bnd
delete mode 100644 dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableServiceTest.java
delete mode 100644 dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProviderTest.java
delete mode 100644 dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/delegation/SecurityRolesBuilder.java
diff --git a/dev/com.ibm.ws.security.appbnd_test/.classpath b/dev/com.ibm.ws.security.appbnd_test/.classpath
deleted file mode 100644
index bd52baaf243d..000000000000
--- a/dev/com.ibm.ws.security.appbnd_test/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/dev/com.ibm.ws.security.appbnd_test/.gitignore b/dev/com.ibm.ws.security.appbnd_test/.gitignore
deleted file mode 100644
index 57b341172a1b..000000000000
--- a/dev/com.ibm.ws.security.appbnd_test/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/bin/
-/generated/
diff --git a/dev/com.ibm.ws.security.appbnd_test/.project b/dev/com.ibm.ws.security.appbnd_test/.project
deleted file mode 100644
index 52213c47fc80..000000000000
--- a/dev/com.ibm.ws.security.appbnd_test/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- com.ibm.ws.security.appbnd_test
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- bndtools.core.bndbuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
- bndtools.core.bndnature
-
-
diff --git a/dev/com.ibm.ws.security.appbnd_test/.settings/org.eclipse.core.resources.prefs b/dev/com.ibm.ws.security.appbnd_test/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 25d9425fe34e..000000000000
--- a/dev/com.ibm.ws.security.appbnd_test/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Ant properties
-#Automatically generated by the ant prepare.settings.files task
-eclipse.preferences.version=1
-encoding/=UTF-8
diff --git a/dev/com.ibm.ws.security.appbnd_test/.settings/org.eclipse.jdt.core.prefs b/dev/com.ibm.ws.security.appbnd_test/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index cd59baf45655..000000000000
--- a/dev/com.ibm.ws.security.appbnd_test/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,286 +0,0 @@
-#Ant properties
-#Automatically generated by the ant prepare.settings.files task
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.8
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=18
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=2
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=2
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=18
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=2
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=18
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=18
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=18
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=18
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=20
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=4
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=false
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=180
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=4
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=8
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=false
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=180
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=true
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/dev/com.ibm.ws.security.appbnd_test/bnd.bnd b/dev/com.ibm.ws.security.appbnd_test/bnd.bnd
deleted file mode 100644
index 0075ac04cca2..000000000000
--- a/dev/com.ibm.ws.security.appbnd_test/bnd.bnd
+++ /dev/null
@@ -1,53 +0,0 @@
-#*******************************************************************************
-# Copyright (c) 2020 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-#*******************************************************************************
--include= ~../cnf/resources/bnd/liberty-release.props
-
--nobundles=true
-
-test.project: true
-
--testpath: \
- ../build.sharedResources/lib/junit/old/junit.jar;version=file, \
- com.ibm.ws.junit.extensions;version=latest, \
- org.hamcrest:hamcrest-all;version=1.3, \
- org.jmock:jmock-junit4;strategy=exact;version=2.5.1, \
- org.jmock:jmock;strategy=exact;version=2.5.1, \
- com.ibm.ws.org.objenesis:objenesis;version=1.0, \
- cglib:cglib-nodep;version=3.3.0, \
- org.jmock:jmock-legacy;version=2.5.0, \
- com.ibm.ws.container.service;version=latest,\
- com.ibm.websphere.security;version=latest,\
- com.ibm.ws.security;version=latest,\
- com.ibm.ws.security.authorization;version=latest, \
- com.ibm.websphere.javaee.servlet.3.0;version=latest,\
- com.ibm.ws.adaptable.module;version=latest,\
- com.ibm.ws.common.encoder,\
- com.ibm.ws.bnd.annotations;version=latest,\
- com.ibm.ws.classloading;version=latest,\
- com.ibm.ws.config,\
- com.ibm.ws.crypto.passwordutil;version=latest, \
- com.ibm.websphere.javaee.connector.1.6;version=latest,\
- com.ibm.ws.kernel.boot,\
- com.ibm.ws.kernel.service,\
- com.ibm.ws.logging;version=latest,\
- com.ibm.websphere.appserver.spi.kernel.service,\
- com.ibm.websphere.org.osgi.core,\
- com.ibm.websphere.org.osgi.service.component,\
- com.ibm.wsspi.org.osgi.service.component.annotations,\
- com.ibm.wsspi.org.osgi.service.metatype.annotations, \
- com.ibm.ws.org.osgi.annotation.versioning;version=latest, \
- com.ibm.ws.javaee.dd,\
- com.ibm.ws.security.jaas.common;version=latest,\
- com.ibm.ws.security.registry;version=latest,\
- com.ibm.ws.security.credentials,\
- com.ibm.ws.security.authorization.builtin;version=latest,\
- com.ibm.ws.security.authentication;version=latest,\
- com.ibm.ws.security.appbnd;version=latest
diff --git a/dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableServiceTest.java b/dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableServiceTest.java
deleted file mode 100644
index 3bfd77f9afcd..000000000000
--- a/dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableServiceTest.java
+++ /dev/null
@@ -1,1127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 2015 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package com.ibm.ws.security.appbnd.internal.authorization;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.component.ComponentContext;
-
-import com.ibm.websphere.csi.J2EEName;
-import com.ibm.ws.container.service.app.deploy.ModuleInfo;
-import com.ibm.ws.container.service.metadata.MetaDataEvent;
-import com.ibm.ws.container.service.metadata.MetaDataException;
-import com.ibm.ws.container.service.security.SecurityRoles;
-import com.ibm.ws.javaee.dd.appbnd.Group;
-import com.ibm.ws.javaee.dd.appbnd.SecurityRole;
-import com.ibm.ws.javaee.dd.appbnd.SpecialSubject;
-import com.ibm.ws.javaee.dd.appbnd.User;
-import com.ibm.ws.runtime.metadata.ApplicationMetaData;
-import com.ibm.ws.security.AccessIdUtil;
-import com.ibm.ws.security.SecurityService;
-import com.ibm.ws.security.appbnd.internal.delegation.DefaultDelegationProvider;
-import com.ibm.ws.security.authorization.AuthorizationTableService;
-import com.ibm.ws.security.authorization.RoleSet;
-import com.ibm.ws.security.delegation.DelegationProvider;
-import com.ibm.ws.security.registry.EntryNotFoundException;
-import com.ibm.ws.security.registry.RegistryException;
-import com.ibm.ws.security.registry.UserRegistry;
-import com.ibm.ws.security.registry.UserRegistryService;
-import com.ibm.wsspi.adaptable.module.Container;
-
-import test.common.SharedOutputManager;
-
-/**
- *
- */
-@SuppressWarnings("unchecked")
-public class AppBndAuthorizationTableServiceTest {
-
- private static SharedOutputManager outputMgr = SharedOutputManager.getInstance();
- /**
- * Using the test rule will drive capture/restore and will dump on error..
- * Notice this is not a static variable, though it is being assigned a value we
- * allocated statically. -- the normal-variable-ness is for before/after processing
- */
- @Rule
- public TestRule managerRule = outputMgr;
-
- private final static String appName = "myApp";
- private final static String realm = "The Realm";
-
- private final static String userName1 = "user1";
- private final static String userAccessId1 = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_USER, realm, userName1);
- private final static String userAccessId1UpperCase = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_USER, realm, userName1.toUpperCase());
- private final static String userName2 = "user2";
- private final static String userAccessId2 = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_USER, realm, userName2);
- private final static String userName3 = "user3";
- private final static String userAccessId3 = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_USER, realm, userName3);
-
- private final static String groupName1 = "group1";
- private final static String groupAccessId1 = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_GROUP, realm, groupName1);
- private final static String groupAccessId1UpperCase = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_GROUP, realm, groupName1.toUpperCase());
- private final static String groupName2 = "group2";
- private final static String groupAccessId2 = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_GROUP, realm, groupName2);
- private final static String groupName3 = "group3";
- private final static String groupAccessId3 = AccessIdUtil.createAccessId(AccessIdUtil.TYPE_GROUP, realm, groupName3);
-
- private final static String roleName1 = "roleName1";
- private final static String roleName2 = "roleName2";
-
- private final static String KEY_SECURITY_SERVICE = "securityService";
- private final static String KEY_CONFIG_ADMIN = "configurationAdmin";
- private final static String KEY_LDAP_REGISTRY = "(service.factoryPid=com.ibm.ws.security.registry.ldap.config)";
- private final static String KEY_IGNORE_CASE = "ignoreCase";
-
- private final Mockery mock = new JUnit4Mockery();
- private final ComponentContext cc = mock.mock(ComponentContext.class);
- private final BundleContext bc = mock.mock(BundleContext.class);
- private final ServiceRegistration delegationRegistration = mock.mock(ServiceRegistration.class);
- private final ServiceReference securityServiceRef = mock.mock(ServiceReference.class);
- private final SecurityService securityService = mock.mock(SecurityService.class);
- private final ServiceReference car = mock.mock(ServiceReference.class, "ConfigurationAdmin");
- private final ConfigurationAdmin ca = mock.mock(ConfigurationAdmin.class);
- private final UserRegistryService userRegistryService = mock.mock(UserRegistryService.class);
- private final UserRegistry userRegistry = mock.mock(UserRegistry.class);
-
- private final ApplicationMetaData appMetaData = mock.mock(ApplicationMetaData.class);
- private final J2EEName appJ2EEName = mock.mock(J2EEName.class);
- private final Container appContainer = mock.mock(Container.class, "appContainer");
- private final MetaDataEvent appEvent = mock.mock(MetaDataEvent.class);
- private final ModuleInfo moduleInfo = mock.mock(ModuleInfo.class);
- private final SecurityRoles securityRoles = mock.mock(SecurityRoles.class);
- private final List listSecurityRoles = new ArrayList();
- private final List listSpecialSubjects = new ArrayList();
- private final SpecialSubject specialSubject = mock.mock(SpecialSubject.class);
- private final User user1 = mock.mock(User.class, "user1");
- private final User user2 = mock.mock(User.class, "user2");
- private final Group group1 = mock.mock(Group.class, "group1");
- private final Group group2 = mock.mock(Group.class, "group2");
- private final SecurityRole secRole1 = mock.mock(SecurityRole.class, "secRole1");
- private final SecurityRole secRole2 = mock.mock(SecurityRole.class, "secRole2");
- private final Configuration lrc = mock.mock(Configuration.class);
- private AppBndAuthorizationTableServiceDouble authzTableListener;
-
- private final Configuration lrcs[] = { lrc };
-
- @Before
- public void setUp() throws Exception {
- mock.checking(new Expectations() {
- {
- allowing(cc).getBundleContext();
- will(returnValue(bc));
- allowing(bc).getBundle();
- allowing(bc).registerService(with(DelegationProvider.class),
- with(any(DefaultDelegationProvider.class)),
- with(any(Dictionary.class)));
- will(returnValue(delegationRegistration));
-
- allowing(cc).locateService(KEY_SECURITY_SERVICE, securityServiceRef);
- will(returnValue(securityService));
- allowing(cc).locateService(KEY_CONFIG_ADMIN, car);
- will(returnValue(ca));
- allowing(securityService).getUserRegistryService();
- will(returnValue(userRegistryService));
- allowing(userRegistryService).getUserRegistry();
- will(returnValue(userRegistry));
- allowing(userRegistryService).isUserRegistryConfigured();
- will(returnValue(true));
- }
- });
-
- authzTableListener = new AppBndAuthorizationTableServiceDouble();
- authzTableListener.setSecurityService(securityServiceRef);
- authzTableListener.setConfigurationAdmin(car);
- authzTableListener.activate(cc);
- }
-
- @After
- public void tearDown() throws Exception {
- mock.checking(new Expectations() {
- {
- allowing(delegationRegistration).unregister();
- }
- });
-
- authzTableListener.deactivate(cc);
- authzTableListener.unsetSecurityService(securityServiceRef);
- authzTableListener.unsetConfigurationAdmin(car);
-
- mock.assertIsSatisfied();
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#deactivate(org.osgi.service.component.Componentmock)}.
- */
- @Test
- public void deactivateUnregistersDelegationService() {
- mock.checking(new Expectations() {
- {
- one(delegationRegistration).unregister();
- }
- });
- authzTableListener.deactivate(cc);
- }
-
- /**
- * Test method for
- * {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#appDeployed(com.ibm.ws.container.service.app.deploy.ApplicationInfo)}.
- */
- @Test
- public void applicationStarting_serverXML() throws Exception {
- mock.checking(new Expectations() {
- {
- one(appEvent).getMetaData();
- will(returnValue(appMetaData));
- one(appMetaData).getJ2EEName();
- will(returnValue(appJ2EEName));
- one(appJ2EEName).getApplication();
- will(returnValue(appName));
- one(appEvent).getContainer();
- will(returnValue(appContainer));
- one(appContainer).adapt(SecurityRoles.class);
- will(returnValue(securityRoles));
- allowing(securityRoles).getSecurityRoles();
- //allowing(securityRoles).getSecurityRoles(SecurityRoles.Source.EarApplicationBnd);
- }
- });
- authzTableListener.applicationMetaDataCreated(appEvent);
- }
-
- /**
- * Test method for
- * {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#appDeployed(com.ibm.ws.container.service.app.deploy.ApplicationInfo)}.
- */
- @Test
- public void applicationStarting_earAppBnd() throws Exception {
- mock.checking(new Expectations() {
- {
- one(appEvent).getMetaData();
- will(returnValue(appMetaData));
- one(appMetaData).getJ2EEName();
- will(returnValue(appJ2EEName));
- one(appJ2EEName).getApplication();
- will(returnValue(appName));
- one(appEvent).getContainer();
- will(returnValue(appContainer));
- one(appContainer).adapt(SecurityRoles.class);
- will(returnValue(securityRoles));
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
- }
- });
- authzTableListener.applicationMetaDataCreated(appEvent);
- }
-
- /**
- * appDeployed should issue a warning message when the authorization
- * table is not created.
- */
- @Test
- public void appDeployed_sameApplicationName() throws Exception {
- mock.checking(new Expectations() {
- {
- exactly(2).of(appEvent).getMetaData();
- will(returnValue(appMetaData));
- exactly(2).of(appMetaData).getJ2EEName();
- will(returnValue(appJ2EEName));
- exactly(2).of(appJ2EEName).getApplication();
- will(returnValue(appName));
- exactly(2).of(appEvent).getContainer();
- will(returnValue(appContainer));
- exactly(2).of(appContainer).adapt(SecurityRoles.class);
- will(returnValue(securityRoles));
- allowing(securityRoles).getSecurityRoles();
- }
- });
-
- authzTableListener.applicationMetaDataCreated(appEvent);
- try {
- authzTableListener.applicationMetaDataCreated(appEvent);
- fail("Excepted StateChangeException when application with the same name is deployed.");
- } catch (MetaDataException e) {
- String expectedMsg = "CWWKS9110E:.*" + appName + ".*";
-
- assertTrue("Expected message was not logged",
- outputMgr.checkForStandardErr(expectedMsg));
- }
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#applicationStopped(java.lang.String)}.
- */
- @Test
- public void applicationMetaDataDestroyed() throws Exception {
- mock.checking(new Expectations() {
- {
- one(appEvent).getMetaData();
- will(returnValue(appMetaData));
- one(appMetaData).getJ2EEName();
- will(returnValue(appJ2EEName));
- one(appJ2EEName).getApplication();
- will(returnValue(appName));
- }
- });
- authzTableListener.applicationMetaDataDestroyed(appEvent);
- }
-
- private void applicationMetaDataCreated(final MetaDataEvent event) throws Exception {
- mock.checking(new Expectations() {
- {
- one(event).getMetaData();
- will(returnValue(appMetaData));
- one(appMetaData).getJ2EEName();
- will(returnValue(appJ2EEName));
- one(appJ2EEName).getApplication();
- will(returnValue(appName));
- one(event).getContainer();
- will(returnValue(appContainer));
- one(appContainer).adapt(SecurityRoles.class);
- will(returnValue(securityRoles));
- }
- });
- authzTableListener.applicationMetaDataCreated(event);
- }
-
- @Test
- public void getRolesForSpecialSubject_noResourceMatch() {
- assertNull("Null should be returned when the resource doesn't match",
- authzTableListener.getRolesForAccessId("mismatch", null));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForSpecialSubject(java.lang.String, java.lang.String)} .
- */
- @Test
- public void getRolesForSpecialSubject_FromEar() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
- listSpecialSubjects.add(specialSubject);
- final String roleName2 = "roleName2";
-
- mock.checking(new Expectations() {
- {
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getSpecialSubjects();
- will(returnValue(new ArrayList()));
- //second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getSpecialSubjects();
- will(returnValue(listSpecialSubjects));
- allowing(specialSubject).getType();
- will(returnValue(SpecialSubject.Type.ALL_AUTHENTICATED_USERS));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- RoleSet roles = authzTableListener.getRolesForSpecialSubject(appName, AuthorizationTableService.ALL_AUTHENTICATED_USERS);
- assertEquals("Roles should only contain roleName2.",
- roles.size(), 1);
- assertTrue("Roles should only contain roleName2.",
- roles.contains(roleName2));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForSpecialSubject(java.lang.String, java.lang.String)} .
- */
- @Test
- public void getRolesForSpecialSubject_FromServer() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
- listSpecialSubjects.add(specialSubject);
- final String roleName2 = "roleName2";
-
- mock.checking(new Expectations() {
- {
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getSpecialSubjects();
- will(returnValue(new ArrayList()));
- // second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getSpecialSubjects();
- will(returnValue(listSpecialSubjects));
- allowing(specialSubject).getType();
- will(returnValue(SpecialSubject.Type.ALL_AUTHENTICATED_USERS));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- RoleSet roles = authzTableListener.getRolesForSpecialSubject(appName, AuthorizationTableService.ALL_AUTHENTICATED_USERS);
- assertEquals("Roles should only contain roleName2.",
- roles.size(), 1);
- assertTrue("Roles should only contain roleName2.",
- roles.contains(roleName2));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForSpecialSubject(java.lang.String, java.lang.String)} .
- */
- @Test
- public void getRolesForSpecialSubject_noSpecialSubjects() throws Exception {
- listSecurityRoles.add(secRole1);
-
- mock.checking(new Expectations() {
- {
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getSpecialSubjects();
- will(returnValue(listSpecialSubjects));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- assertEquals("Roles should be an empty list when no special subjects are defined.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForSpecialSubject(appName, AuthorizationTableService.ALL_AUTHENTICATED_USERS));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForSpecialSubject(java.lang.String, java.lang.String)} .
- */
- @Test
- public void getRolesForSpecialSubject_noMatchingSpecialSubject() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
- listSpecialSubjects.add(specialSubject);
- final String roleName2 = "roleName2";
- mock.checking(new Expectations() {
- {
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getSpecialSubjects();
- will(returnValue(new ArrayList()));
- //second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getSpecialSubjects();
- will(returnValue(listSpecialSubjects));
- allowing(specialSubject).getType();
- will(returnValue(SpecialSubject.Type.ALL_AUTHENTICATED_USERS));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- assertEquals("Roles should be an empty list when no matching special subjects are found.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForSpecialSubject(appName, AuthorizationTableService.EVERYONE));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForSpecialSubject(java.lang.String, java.lang.String)} .
- */
- @Test
- public void getRolesForSpecialSubject_noRoles() throws Exception {
- mock.checking(new Expectations() {
- {
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- assertEquals("Roles should be an empty list when no matching special subjects are found.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForSpecialSubject(appName, AuthorizationTableService.EVERYONE));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForSpecialSubject(java.lang.String, java.lang.String)} .
- */
- @Test
- public void getRolesForSpecialSubject_cached() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
- listSpecialSubjects.add(specialSubject);
- final String roleName2 = "roleName2";
-
- mock.checking(new Expectations() {
- {
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getSpecialSubjects();
- will(returnValue(new ArrayList()));
- // second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getSpecialSubjects();
- will(returnValue(listSpecialSubjects));
-
- allowing(specialSubject).getType();
- will(returnValue(SpecialSubject.Type.ALL_AUTHENTICATED_USERS));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- RoleSet roles = authzTableListener.getRolesForSpecialSubject(appName, AuthorizationTableService.ALL_AUTHENTICATED_USERS);
- assertEquals("Roles should only contain roleName2.",
- roles.size(), 1);
- assertTrue("Roles should only contain roleName2.",
- roles.contains(roleName2));
-
- // Call again, should get a cache hit
- roles = authzTableListener.getRolesForSpecialSubject(appName, AuthorizationTableService.ALL_AUTHENTICATED_USERS);
- assertEquals("Roles should only contain roleName2.",
- roles.size(), 1);
- assertTrue("Roles should only contain roleName2.",
- roles.contains(roleName2));
- }
-
- @Test
- public void getRolesForAccessId_noResourceMatch() {
- assertNull("Null should be returned when the resource doesn't match",
- authzTableListener.getRolesForAccessId("mismatch", null));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForAccessId_FromServer() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
-
- final List secRole1Users = new ArrayList();
- secRole1Users.add(user1);
- final List secRole2Users = new ArrayList();
- secRole2Users.add(user2);
-
- mock.checking(new Expectations() {
- {
- one(userRegistryService).getUserRegistryType();
- will(returnValue("Basic"));
-
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getUsers();
- will(returnValue(secRole1Users));
-
- //first user
- one(user1).getAccessId();
- will(returnValue(null));
- exactly(2).of(user1).getName();
- will(returnValue(userName1));
- one(userRegistry).getRealm();
- will(returnValue(realm));
- one(userRegistry).getUniqueUserId(userName1);
- will(returnValue(userName1));
-
- //second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getUsers();
- will(returnValue(secRole2Users));
-
- //second user
- one(user2).getName();
- will(returnValue(userName2));
- one(user2).getAccessId();
- will(returnValue(userAccessId2));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- RoleSet roles = authzTableListener.getRolesForAccessId(appName, userAccessId1);
- assertEquals("Roles should only contain roleName1.",
- roles.size(), 1);
- assertTrue("Roles should only contain roleName1.",
- roles.contains(roleName1));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForAccessId_noMatchingAccessIds() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
-
- final List secRole1Users = new ArrayList();
- secRole1Users.add(user1);
- final List secRole2Users = new ArrayList();
- secRole2Users.add(user2);
-
- mock.checking(new Expectations() {
- {
- one(userRegistryService).getUserRegistryType();
- will(returnValue("Basic"));
-
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getUsers();
- will(returnValue(secRole1Users));
-
- //first user
- one(user1).getAccessId();
- will(returnValue(null));
- exactly(2).of(user1).getName();
- will(returnValue(userName1));
- one(userRegistry).getRealm();
- will(returnValue(realm));
- one(userRegistry).getUniqueUserId(userName1);
- will(returnValue(userName1));
-
- //second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getUsers();
- will(returnValue(secRole2Users));
-
- //second user
- one(user2).getName();
- will(returnValue(userName2));
- one(user2).getAccessId();
- will(returnValue(userAccessId2));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- assertEquals("Roles should be empty when userAccessId3 is not mapped to any of the roles.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForAccessId(appName, userAccessId3));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForAccessId_NoUsers() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
-
- final List noUsers = new ArrayList();
-
- mock.checking(new Expectations() {
- {
- //first role
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getUsers();
- will(returnValue(noUsers));
-
- //second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getUsers();
- will(returnValue(noUsers));
- }
- });
-
- applicationMetaDataCreated(appEvent);
- assertEquals("Roles should be empty when there are no users in the security-role element.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForAccessId(appName, userAccessId1));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForGroupAccessId_FromServer() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
-
- final List secRole1Groups = new ArrayList();
- secRole1Groups.add(group1);
- final List secRole2Groups = new ArrayList();
- secRole2Groups.add(group2);
-
- mock.checking(new Expectations() {
- {
- one(userRegistryService).getUserRegistryType();
- will(returnValue("Basic"));
-
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- //first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getGroups();
- will(returnValue(secRole1Groups));
-
- //first group
- one(group1).getAccessId();
- will(returnValue(null));
- exactly(2).of(group1).getName();
- will(returnValue(groupName1));
- one(userRegistry).getRealm();
- will(returnValue(realm));
- one(userRegistry).getUniqueGroupId(groupName1);
- will(returnValue(groupName1));
-
- //second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getGroups();
- will(returnValue(secRole2Groups));
-
- //second group
- one(group2).getName();
- will(returnValue(groupName2));
- one(group2).getAccessId();
- will(returnValue(groupAccessId2));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- RoleSet roles = authzTableListener.getRolesForAccessId(appName, groupAccessId1);
- assertEquals("Roles should only contain roleName1.",
- roles.size(), 1);
- assertTrue("Roles should only contain roleName1.",
- roles.contains(roleName1));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForGroupAccessId_noMatchingGroupAccessIds() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
-
- final List secRole1Groups = new ArrayList();
- secRole1Groups.add(group1);
- final List secRole2Groups = new ArrayList();
- secRole2Groups.add(group2);
-
- mock.checking(new Expectations() {
- {
- one(userRegistryService).getUserRegistryType();
- will(returnValue("Basic"));
-
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- //first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getGroups();
- will(returnValue(secRole1Groups));
-
- //first group
- one(group1).getAccessId();
- will(returnValue(null));
- exactly(2).of(group1).getName();
- will(returnValue(groupName1));
- one(userRegistry).getRealm();
- will(returnValue(realm));
- one(userRegistry).getUniqueGroupId(groupName1);
- will(returnValue(groupName1));
-
- //second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getGroups();
- will(returnValue(secRole2Groups));
-
- //second group
- one(group2).getName();
- will(returnValue(groupName2));
- one(group2).getAccessId();
- will(returnValue(groupAccessId2));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- assertEquals("Roles should be empty when groupAccessId3 is not mapped to any of the roles.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForAccessId(appName, groupAccessId3));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForGroupAccessId_NoGroups() throws Exception {
- listSecurityRoles.add(secRole1);
- listSecurityRoles.add(secRole2);
-
- final List noGroups = new ArrayList();
-
- mock.checking(new Expectations() {
- {
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- //first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getGroups();
- will(returnValue(noGroups));
-
- //second role
- one(secRole2).getName();
- will(returnValue(roleName2));
- one(secRole2).getGroups();
- will(returnValue(noGroups));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- assertEquals("Roles should be empty when there are no users in the security-role element.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForAccessId(appName, groupAccessId1));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForAccessId_NoRoles() throws Exception {
- mock.checking(new Expectations() {
- {
- //first role
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- assertEquals("Roles should be empty when there are no users in the security-role element.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForAccessId(appName, userAccessId1));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForAccessId_FromServer_ignoreCase_True() throws Exception {
- listSecurityRoles.add(secRole1);
-
- final List secRole1Users = new ArrayList();
- secRole1Users.add(user1);
-
- final Dictionary props = new Hashtable();
- props.put(KEY_IGNORE_CASE, "true");
-
- mock.checking(new Expectations() {
- {
- one(userRegistryService).getUserRegistryType();
- will(returnValue("WIM"));
-
- one(ca).listConfigurations(KEY_LDAP_REGISTRY);
- will(returnValue(lrcs));
-
- one(lrc).getProperties();
- will(returnValue(props));
-
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getUsers();
- will(returnValue(secRole1Users));
-
- //first user
- one(user1).getAccessId();
- will(returnValue(null));
- exactly(2).of(user1).getName();
- will(returnValue(userName1));
- one(userRegistry).getRealm();
- will(returnValue(realm));
- one(userRegistry).getUniqueUserId(userName1);
- will(returnValue(userName1));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- RoleSet roles = authzTableListener.getRolesForAccessId(appName, userAccessId1UpperCase);
- assertEquals("Roles should only contain roleName1.",
- roles.size(), 1);
- assertTrue("Roles should only contain roleName1.",
- roles.contains(roleName1));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForAccessId_FromServer_NoRole_ignoreCase_False() throws Exception {
- listSecurityRoles.add(secRole1);
-
- final List secRole1Users = new ArrayList();
- secRole1Users.add(user1);
-
- final Dictionary props = new Hashtable();
- props.put(KEY_IGNORE_CASE, "false");
-
- mock.checking(new Expectations() {
- {
- one(userRegistryService).getUserRegistryType();
- will(returnValue("WIM"));
-
- one(ca).listConfigurations(KEY_LDAP_REGISTRY);
- will(returnValue(lrcs));
-
- one(lrc).getProperties();
- will(returnValue(props));
-
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- // first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getUsers();
- will(returnValue(secRole1Users));
-
- //first user
- one(user1).getAccessId();
- will(returnValue(null));
- exactly(2).of(user1).getName();
- will(returnValue(userName1));
- one(userRegistry).getRealm();
- will(returnValue(realm));
- one(userRegistry).getUniqueUserId(userName1);
- will(returnValue(userName1));
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- assertEquals("Roles should be empty since ignoreCase is set as false.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForAccessId(appName, userAccessId1UpperCase));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForGroupAccessId_FromServer_ignoreCase_True() throws Exception {
- listSecurityRoles.add(secRole1);
-
- final List secRole1Groups = new ArrayList();
- secRole1Groups.add(group1);
-
- final Dictionary props = new Hashtable();
- props.put(KEY_IGNORE_CASE, "true");
-
- mock.checking(new Expectations() {
- {
- one(userRegistryService).getUserRegistryType();
- will(returnValue("WIM"));
- one(ca).listConfigurations(KEY_LDAP_REGISTRY);
- will(returnValue(lrcs));
- one(lrc).getProperties();
- will(returnValue(props));
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- //first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getGroups();
- will(returnValue(secRole1Groups));
-
- //first group
- one(group1).getAccessId();
- will(returnValue(null));
- exactly(2).of(group1).getName();
- will(returnValue(groupName1));
- one(userRegistry).getRealm();
- will(returnValue(realm));
- one(userRegistry).getUniqueGroupId(groupName1);
- will(returnValue(groupName1));
-
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- RoleSet roles = authzTableListener.getRolesForAccessId(appName, groupAccessId1UpperCase);
- assertEquals("Roles should only contain roleName1.",
- roles.size(), 1);
- assertTrue("Roles should only contain roleName1.",
- roles.contains(roleName1));
- }
-
- /**
- * Test method for {@link com.ibm.ws.security.appbnd.internal.authorization.AppBndAuthorizationTableService#getRolesForAccessId(java.lang.String, java.lang.String)} .
- *
- * @throws RegistryException
- * @throws EntryNotFoundException
- */
- @Test
- public void getRolesForGroupAccessId_FromServer_NoRole_ignoreCase_False() throws Exception {
- listSecurityRoles.add(secRole1);
-
- final List secRole1Groups = new ArrayList();
- secRole1Groups.add(group1);
-
- final Dictionary props = new Hashtable();
- props.put(KEY_IGNORE_CASE, "false");
-
- mock.checking(new Expectations() {
- {
- one(userRegistryService).getUserRegistryType();
- will(returnValue("WIM"));
- one(ca).listConfigurations(KEY_LDAP_REGISTRY);
- will(returnValue(lrcs));
- one(lrc).getProperties();
- will(returnValue(props));
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(listSecurityRoles));
-
- //first role
- one(secRole1).getName();
- will(returnValue(roleName1));
- one(secRole1).getGroups();
- will(returnValue(secRole1Groups));
-
- //first group
- one(group1).getAccessId();
- will(returnValue(null));
- exactly(2).of(group1).getName();
- will(returnValue(groupName1));
- one(userRegistry).getRealm();
- will(returnValue(realm));
- one(userRegistry).getUniqueGroupId(groupName1);
- will(returnValue(groupName1));
-
- }
- });
-
- applicationMetaDataCreated(appEvent);
-
- assertEquals("Roles should be empty since ignoreCase is set as false.",
- RoleSet.EMPTY_ROLESET,
- authzTableListener.getRolesForAccessId(appName, groupAccessId1UpperCase));
- }
-
- class AppBndAuthorizationTableServiceDouble extends AppBndAuthorizationTableService {
- public AppBndAuthorizationTableServiceDouble() {
- super();
- }
-
- @Override
- protected void setSecurityService(ServiceReference reference) {
- super.setSecurityService(reference);
- }
-
- @Override
- protected void unsetSecurityService(ServiceReference reference) {
- super.unsetSecurityService(reference);
- }
-
- @Override
- protected void setConfigurationAdmin(ServiceReference reference) {
- super.setConfigurationAdmin(reference);
- }
-
- @Override
- protected void unsetConfigurationAdmin(ServiceReference reference) {
- super.unsetConfigurationAdmin(reference);
- }
- }
-
-}
diff --git a/dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProviderTest.java b/dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProviderTest.java
deleted file mode 100644
index e2513f80cc4d..000000000000
--- a/dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/delegation/DefaultDelegationProviderTest.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package com.ibm.ws.security.appbnd.internal.delegation;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-
-import javax.security.auth.Subject;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import test.common.SharedOutputManager;
-
-import com.ibm.ws.javaee.dd.appbnd.SecurityRole;
-import com.ibm.ws.security.SecurityService;
-import com.ibm.ws.security.authentication.AuthenticationData;
-import com.ibm.ws.security.authentication.AuthenticationException;
-import com.ibm.ws.security.authentication.AuthenticationService;
-import com.ibm.ws.security.authentication.WSAuthenticationData;
-import com.ibm.ws.security.authentication.utility.JaasLoginConfigConstants;
-import com.ibm.wsspi.adaptable.module.UnableToAdaptException;
-
-/**
- *
- */
-public class DefaultDelegationProviderTest {
-
- private static final String APP1_NAME = "TestApp";
- private static final String APP2_NAME = "AnotherTestApp";
- private static final String RUNAS_ROLE = "testRole";
- private static final String RUNAS_ROLE_NOT_IN_BINDINGS = "badRole";
- private static final String APP1_MAPPED_USER = "user1";
- private static final String APP1_MAPPED_PASSWORD = "user1pwd";
- private static final String APP2_MAPPED_USER = "user2";
- private static final String APP2_MAPPED_PASSWORD = "user2pwd";
- private static SharedOutputManager outputMgr;
- private final Mockery mockery = new JUnit4Mockery();
- private List app1SecurityRoles;
- private List app2SecurityRoles;
- private AuthenticationData app1AuthenticationData;
- private AuthenticationData app2AuthenticationData;
- private final Subject app1RunAsSubject = new Subject();
- private final Subject app2RunAsSubject = new Subject();
- private DefaultDelegationProvider defaultDelegationProvider;
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- outputMgr = SharedOutputManager.getInstance();
- outputMgr.captureStreams();
- }
-
- @Before
- public void setUp() throws Exception {
- SecurityRolesBuilder securityRolesBuilder = new SecurityRolesBuilder(mockery);
- securityRolesBuilder.buildSecurityRole(RUNAS_ROLE, APP1_MAPPED_USER, APP1_MAPPED_PASSWORD);
- app1SecurityRoles = securityRolesBuilder.getSecurityRoles().getSecurityRoles();
-
- securityRolesBuilder.buildSecurityRole(RUNAS_ROLE, APP2_MAPPED_USER, APP2_MAPPED_PASSWORD);
- app2SecurityRoles = securityRolesBuilder.getSecurityRoles().getSecurityRoles();
-
- app1AuthenticationData = createAuthenticationData(APP1_MAPPED_USER, APP1_MAPPED_PASSWORD);
- app2AuthenticationData = createAuthenticationData(APP2_MAPPED_USER, APP2_MAPPED_PASSWORD);
-
- AuthenticationService authenticationService = createAuthenticationService();
- SecurityService securityService = createSecurityService(authenticationService);
- defaultDelegationProvider = createPopulatedMethodDelegationProvider(securityService);
- }
-
- private AuthenticationData createAuthenticationData(String userName, String password) {
- final AuthenticationData authenticationData = new WSAuthenticationData();
- authenticationData.set(AuthenticationData.USERNAME, userName);
- authenticationData.set(AuthenticationData.PASSWORD, password.toCharArray());
- return authenticationData;
- }
-
- private AuthenticationService createAuthenticationService() throws AuthenticationException {
- final AuthenticationService authenticationService = mockery.mock(AuthenticationService.class);
- mockery.checking(new Expectations() {
- {
- allowing(authenticationService).authenticate(JaasLoginConfigConstants.SYSTEM_WEB_INBOUND, app1AuthenticationData, null);
- will(returnValue(app1RunAsSubject));
- allowing(authenticationService).authenticate(JaasLoginConfigConstants.SYSTEM_WEB_INBOUND, app2AuthenticationData, null);
- will(returnValue(app2RunAsSubject));
- }
- });
- return authenticationService;
- }
-
- private SecurityService createSecurityService(final AuthenticationService authenticationService) {
- final SecurityService securityService = mockery.mock(SecurityService.class);
- mockery.checking(new Expectations() {
- {
- allowing(securityService).getAuthenticationService();
- will(returnValue(authenticationService));
- }
- });
- return securityService;
- }
-
- private DefaultDelegationProvider createPopulatedMethodDelegationProvider(SecurityService securityService) throws UnableToAdaptException {
- DefaultDelegationProvider defaultDelegationProvider = createMethodDelegationProviderDouble(securityService);
- defaultDelegationProvider.createAppToSecurityRolesMapping(APP1_NAME, app1SecurityRoles);
- defaultDelegationProvider.createAppToSecurityRolesMapping(APP2_NAME, app2SecurityRoles);
- return defaultDelegationProvider;
- }
-
- private DefaultDelegationProvider createMethodDelegationProviderDouble(SecurityService securityService) {
- DefaultDelegationProvider defaultDelegationProvider = new DefaultDelegationProvider() {
-
- @Override
- protected AuthenticationData createAuthenticationData(String username, String password) {
- if (username.equalsIgnoreCase(APP1_MAPPED_USER) && password.equalsIgnoreCase(APP1_MAPPED_PASSWORD)) {
- return app1AuthenticationData;
- } else if (username.equalsIgnoreCase(APP2_MAPPED_USER) && password.equalsIgnoreCase(APP2_MAPPED_PASSWORD)) {
- return app2AuthenticationData;
- } else {
- return new WSAuthenticationData();
- }
- }
- };
- defaultDelegationProvider.setSecurityService(securityService);
- return defaultDelegationProvider;
- }
-
- @After
- public void tearDown() throws Exception {
- outputMgr.resetStreams();
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- outputMgr.restoreStreams();
- }
-
- @Test
- public void testGetRunAsSubject() {
- final String methodName = "testGetRunAsSubject";
- try {
- Subject currentRunAsSubject = defaultDelegationProvider.getRunAsSubject(RUNAS_ROLE, APP1_NAME);
- assertSame("The RunAs subject must be the same as the test RunAs subject.", app1RunAsSubject, currentRunAsSubject);
- } catch (Throwable t) {
- outputMgr.failWithThrowable(methodName, t);
- }
- }
-
- @Test
- public void testGetRunAsSubjectWithBadRoleReturnsNullSubject() {
- final String expectedMessage = "CWWKS9112W.*" + RUNAS_ROLE_NOT_IN_BINDINGS + "*.*" + APP1_NAME;
- final String methodName = "testGetRunAsSubjectWithBadRoleReturnsNullSubject";
- try {
- Subject currentRunAsSubject = defaultDelegationProvider.getRunAsSubject(RUNAS_ROLE_NOT_IN_BINDINGS, APP1_NAME);
- assertNull("The RunAs subject must be null when the role is not in the bindings.", currentRunAsSubject);
- } catch (Throwable t) {
- outputMgr.failWithThrowable(methodName, t);
- }
- assertTrue("The expected warning message should have been found: " + expectedMessage, outputMgr.checkForMessages(expectedMessage));
- }
-
- @Test
- public void testGetRunAsSubjectSameRoleAnotherAppReturnsAnotherSubject() {
- final String methodName = "testGetRunAsSubjectSameRoleAnotherAppReturnsAnotherSubject";
- try {
- Subject currentRunAsSubject = defaultDelegationProvider.getRunAsSubject(RUNAS_ROLE, APP2_NAME);
- assertSame("The RunAs subject must be the same as the app2 RunAs subject.", app2RunAsSubject, currentRunAsSubject);
- } catch (Throwable t) {
- outputMgr.failWithThrowable(methodName, t);
- }
- }
-
- @Test
- public void testRemoveMappings() {
- final String methodName = "testRemoveMappings";
- try {
- defaultDelegationProvider.removeRoleToRunAsMapping(APP1_NAME);
- Subject currentRunAsSubject = defaultDelegationProvider.getRunAsSubject(RUNAS_ROLE, APP1_NAME);
- assertNull("The RunAs subject must be null since the mappings were removed.", currentRunAsSubject);
- } catch (Throwable t) {
- outputMgr.failWithThrowable(methodName, t);
- }
- }
-
- @Test
- public void testRemoveMappingsCanStillGetRunAsSubjectForAnotherApp() {
- final String methodName = "testRemoveMappingsCanStillGetRunAsSubjectForAnotherApp";
- try {
- defaultDelegationProvider.removeRoleToRunAsMapping(APP1_NAME);
- Subject currentRunAsSubject = defaultDelegationProvider.getRunAsSubject(RUNAS_ROLE, APP2_NAME);
- assertSame("The RunAs subject must be the same as the app2 RunAs subject.", app2RunAsSubject, currentRunAsSubject);
- } catch (Throwable t) {
- outputMgr.failWithThrowable(methodName, t);
- }
- }
-
- @Test
- public void testRemoveMappingsWithUnexistingAppDoesNotThrowException() {
- final String methodName = "testRemoveMappingsWithUnexistingAppDoesNotThrowException";
- try {
- defaultDelegationProvider.removeRoleToRunAsMapping("AppNameThatDoesNotExist");
- } catch (Throwable t) {
- outputMgr.failWithThrowable(methodName, t);
- }
- }
-
-}
diff --git a/dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/delegation/SecurityRolesBuilder.java b/dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/delegation/SecurityRolesBuilder.java
deleted file mode 100644
index 10b5a87a0e20..000000000000
--- a/dev/com.ibm.ws.security.appbnd_test/test/com/ibm/ws/security/appbnd/internal/delegation/SecurityRolesBuilder.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package com.ibm.ws.security.appbnd.internal.delegation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-
-import com.ibm.ws.container.service.security.SecurityRoles;
-import com.ibm.ws.javaee.dd.appbnd.RunAs;
-import com.ibm.ws.javaee.dd.appbnd.SecurityRole;
-import com.ibm.wsspi.adaptable.module.UnableToAdaptException;
-
-/**
- * This helper class builds the test SecurityRoles objects. The usage pattern is to first invoke
- * buildSecurityRole in order to create a single role. Continue invoking buildSecurityRole until
- * all the desired roles are created for a single SecurityRoles object. Finally, invoke getSecurityRoles
- * to get the built SecurityRoles object.
- */
-class SecurityRolesBuilder {
-
- private final Mockery mockery;
- private final List currentSecurityRoleList;
-
- public SecurityRolesBuilder(Mockery mockery) {
- this.mockery = mockery;
- currentSecurityRoleList = new ArrayList();
- }
-
- public void buildSecurityRole(String roleName, String runasUserName, String runasUserPassword) {
- RunAs runAs = createRunAs(runasUserName, runasUserPassword);
- SecurityRole securityRole = createSecurityRole(roleName, runAs);
- currentSecurityRoleList.add(securityRole);
- }
-
- public SecurityRoles getSecurityRoles() throws UnableToAdaptException {
- SecurityRoles securityRoles = createSecurityRoles();
- clearCurrentSecurityRoleListForNextBuildCycle();
- return securityRoles;
- }
-
- private RunAs createRunAs(final String userName, final String password) {
- final RunAs runAs = mockery.mock(RunAs.class, "RunAs:" + userName + ":" + password + ":" + System.currentTimeMillis());
- mockery.checking(new Expectations() {
- {
- allowing(runAs).getUserid();
- will(returnValue(userName));
- allowing(runAs).getPassword();
- will(returnValue(password));
- }
- });
- return runAs;
- }
-
- private SecurityRole createSecurityRole(final String roleName, final RunAs runAs) {
- final SecurityRole securityRole = mockery.mock(SecurityRole.class, "SecurityRole:" + runAs.toString());
- mockery.checking(new Expectations() {
- {
- allowing(securityRole).getName();
- will(returnValue(roleName));
- allowing(securityRole).getRunAs();
- will(returnValue(runAs));
- }
- });
- return securityRole;
- }
-
- private SecurityRoles createSecurityRoles() throws UnableToAdaptException {
- final List securityRoleList = new ArrayList(currentSecurityRoleList);
- final SecurityRoles securityRoles = mockery.mock(SecurityRoles.class, "SecurityRoles:" + securityRoleList.toString());
- mockery.checking(new Expectations() {
- {
- allowing(securityRoles).getSecurityRoles();
- will(returnValue(securityRoleList));
- }
- });
- return securityRoles;
- }
-
- private void clearCurrentSecurityRoleListForNextBuildCycle() {
- currentSecurityRoleList.clear();
- }
-
-}