示例#1
0
 /**
  * @return Core_Kopauth
  */
 public static function instance()
 {
     if (!self::$instance instanceof Kopauth) {
         self::$instance = new Kopauth();
     }
     return self::$instance;
 }
示例#2
0
 /**
  * Destroy session data for a provider
  */
 public function action_logout()
 {
     Kopauth::instance()->clear_authenticated($this->request->param('strategy'));
     $this->redirect(Route::url('kopauth', null, true));
 }
示例#3
0
                max-width: none !important;
                width: 970px;
            }
        </style>
    </head>
    <body>

        <div class="container">
            
            <div class="page-header">
                <h1>Kopauth Module Example</h1>
                <h4>Authenticate with the following providers</h4>
            </div>

            <?php 
$kopauth = Kopauth::instance();
$error_message = Session::instance()->get_once('kopauth_error');
// Display error flash message if set
if ($error_message) {
    unset($error_message['raw']);
    echo '<div class="alert alert-danger">';
    foreach ($error_message as $key => $value) {
        echo '<p><strong>' . $key . ':</strong> ' . $value . '</p>';
    }
    echo '</div>';
}
// Create list of configured providers
foreach ($kopauth->env['Strategy'] as $strategy) {
    $is_authenticated = $kopauth->is_authenticated($strategy['strategy_url_name']);
    $auth_route = URL::site(Route::get('kopauth')->uri(array('action' => 'authenticate', 'strategy' => $strategy['strategy_url_name'])));
    $button_class = $is_authenticated ? 'btn-success' : 'btn-primary';