7 class LoginAutoInitiateTest extends TestCase
9 protected function setUp(): void
14 'auth.auto_initiate' => true,
15 'services.google.client_id' => false,
16 'services.github.client_id' => false,
20 public function test_with_oidc()
23 'auth.method' => 'oidc',
26 $req = $this->get('/login');
27 $req->assertSeeText('Attempting Login');
28 $this->withHtml($req)->assertElementExists('form[action$="/oidc/login"][method=POST][id="login-form"] button');
29 $this->withHtml($req)->assertElementExists('button[form="login-form"]');
32 public function test_with_saml2()
35 'auth.method' => 'saml2',
38 $req = $this->get('/login');
39 $req->assertSeeText('Attempting Login');
40 $this->withHtml($req)->assertElementExists('form[action$="/saml2/login"][method=POST][id="login-form"] button');
41 $this->withHtml($req)->assertElementExists('button[form="login-form"]');
44 public function test_it_does_not_run_if_social_provider_is_active()
47 'auth.method' => 'oidc',
48 'services.google.client_id' => 'abc123a',
49 'services.google.client_secret' => 'def456',
52 $req = $this->get('/login');
53 $req->assertDontSeeText('Attempting Login');
54 $req->assertSee('Log In');
57 public function test_it_does_not_run_if_prevent_query_string_exists()
60 'auth.method' => 'oidc',
63 $req = $this->get('/login?prevent_auto_init=true');
64 $req->assertDontSeeText('Attempting Login');
65 $req->assertSee('Log In');
68 public function test_logout_with_auto_init_leads_to_login_page_with_prevention_query()
71 'auth.method' => 'oidc',
73 $this->actingAs($this->getEditor());
75 $req = $this->post('/logout');
76 $req->assertRedirect('/login?prevent_auto_init=true');