Skip to content
Snippets Groups Projects
Select Git revision
  • 953b72f7ee6fee4ee67a2a1be16f08fc7623fe01
  • master default
  • rocky-linux-9
  • development
  • v1.0.4
  • v1.0.3
  • v1.0.2
7 results

TestLogin.php

Blame
  • TestLogin.php 1022 B
    <?php
    
    namespace RAP;
    
    class TestLogin extends LoginHandler {
    
        private $fakeIdentities = [];
    
        public function __construct(Locator $locator) {
            parent::__construct($locator);
    
            // Create fake identities
            $this->fakeIdentities[1] = $this->getFakeIdentity(Identity::EDU_GAIN, 1);
            $this->fakeIdentities[2] = $this->getFakeIdentity(Identity::GOOGLE, 2);
            $this->fakeIdentities[3] = $this->getFakeIdentity(Identity::LINKEDIN, 3);
        }
    
        public function login(): string {
            return $this->locator->getBasePath() . '/auth/test/select';
        }
    
        public function retrieveToken(int $id): string {
            return $this->onIdentityDataReceived($this->fakeIdentities[$id]);
        }
    
        private function getFakeIdentity(string $type, int $i): Identity {
            $identity = new Identity($type);
            $identity->email = 'fake-user' . $i . "@example.com";
            $identity->eppn = $identity->email;
            $identity->typedId = 'fake-user' . $i;
            return $identity;
        }
    
    }