def enable_external_auth_rhsso(enroll_configure_rhsso_external_auth): """register the satellite with RH-SSO Server for single sign-on""" client_id = get_rhsso_client_id() create_mapper(GROUP_MEMBERSHIP_MAPPER, client_id) audience_mapper = copy.deepcopy(AUDIENCE_MAPPER) audience_mapper["config"]["included.client.audience"] = audience_mapper[ "config"]["included.client.audience"].format( rhsso_host=settings.server.hostname) create_mapper(audience_mapper, client_id)
def enable_external_auth_rhsso(enroll_configure_rhsso_external_auth, default_sat): """register the satellite with RH-SSO Server for single sign-on""" client_id = get_rhsso_client_id() create_mapper(GROUP_MEMBERSHIP_MAPPER, client_id) audience_mapper = copy.deepcopy(AUDIENCE_MAPPER) audience_mapper['config']['included.client.audience'] = audience_mapper[ 'config']['included.client.audience'].format(rhsso_host=default_sat) create_mapper(audience_mapper, client_id) set_the_redirect_uri()
def test_external_new_user_login_and_check_count_rhsso( enable_external_auth_rhsso, external_user_count, rhsso_setting_setup, session ): """Verify the external new user login and verify the external user count :id: bf938ea2-6df9-11ea-a7cf-951107ed0bbb :setup: Enroll the RH-SSO Configuration for External Authentication :CaseImportance: Medium :steps: 1. Create new user on RHSSO Instance and Update the Settings in Satellite 2. Verify the login for that user :expectedresults: New User created in RHSSO server should able to get log-in and correct count shown for external users """ client_id = get_rhsso_client_id() user_details = create_new_rhsso_user(client_id) login_details = { 'username': user_details['username'], 'password': settings.rhsso.password, } with Session(login=False) as rhsso_session: rhsso_session.rhsso_login.login(login_details) actual_user = rhsso_session.task.read_all(widget_names="current_user")['current_user'] assert user_details['firstName'] in actual_user users = entities.User().search() updated_count = len([user for user in users if user.auth_source_name == 'External']) assert updated_count == external_user_count + 1 # checking delete user can't login anymore delete_rhsso_user(user_details['username']) with Session(login=False) as rhsso_session: with raises(NavigationTriesExceeded) as error: rhsso_session.rhsso_login.login(login_details) rhsso_session.task.read_all() assert error.typename == "NavigationTriesExceeded"