public function configureApplication(Weblet $app)
    {
        parent::configureApplication($app);
        $app->enableSecurity();
        $app['soauth.test'] = true;
        $app['soauth.client.provider.config'] = ['1' => ['name' => 'Client Application', 'domain' => 'e4mpl3.ngrok.com', 'active' => 'true', 'secret' => 'ch3ng4Th15!']];
        $app['soauth.user.provider.config'] = ['*****@*****.**' => ['password' => $app['security.encoder.digest']->encodePassword('Password123', ''), 'roles' => ['ROLE_USER'], 'enabled' => true]];
        $renderMock = $this->getMock('Renegare\\Soauth\\RendererInterface');
        $renderMock->expects($this->any())->method('renderSignInForm')->will($this->returnCallback(function ($data) {
            extract($data);
            $tmpl = <<<'EOF'
<form method="post">
    <input type="text" name="username" value="%s"/>
    <input type="password" name="password" />
    <input type="hidden" name="redirect_uri" value="%s" />
    <input type="hidden" name="client_id" value="%s" />
    <button type="submit">Sign-in</button>
</form>
EOF;
            $username = isset($username) ? $username : '';
            return sprintf($tmpl, $username, $redirect_uri, $client_id);
        }));
        $app['soauth.renderer'] = $renderMock;
        $app->get('/test-endpoint', function () use($app) {
            return $app['security']->getToken()->getUsername();
        });
    }
예제 #2
0
 public function configureApplication(Weblet $app)
 {
     parent::configureApplication($app);
     $app->enableSecurity();
     $app['soauth.test'] = true;
 }