source: sandbox/2.4.1-3/prototype/library/oauth2/server/examples/pdo/lib/OAuth2StorageUserCredential.php @ 6351

Revision 6351, 1.9 KB checked in by gustavo, 12 years ago (diff)

Ticket #2768 - Melhorias na inserção de destinatários na criacao de mensagem

  • Property svn:executable set to *
Line 
1<?php
2
3/**
4 * @file
5 * Sample OAuth2 Library PDO DB Implementation.
6 *
7 * Simply pass in a configured PDO class, eg:
8 * new OAuth2StoragePDO( new PDO('mysql:dbname=mydb;host=localhost', 'user', 'pass') );
9 */
10//session_start();
11//require __DIR__ . '/../../../../lib/OAuth2.php';
12///require __DIR__ . '/../../../../lib/IOAuth2Storage.php';
13//require __DIR__ . '/../../../../lib/IOAuth2GrantCode.php';
14//require __DIR__ . '/../../../../lib/IOAuth2RefreshTokens.php';
15require __DIR__ . '/../../../../lib/IOAuth2GrantUser.php';
16
17/**
18 * PDO storage engine for the OAuth2 Library.
19 *
20 * IMPORTANT: This is provided as an example only. In production you may implement
21 * a client-specific salt in the OAuth2StoragePDO::hash() and possibly other goodies.
22 *
23 *** The point is, use this as an EXAMPLE ONLY. ***
24 */
25class OAuth2StorageUserCredential implements IOAuth2GrantUser, IOAuth2RefreshTokens {
26
27        private $valid_client_id = 666;
28
29        public function checkUserCredentials($client_id, $username, $password) {
30                if( $client_id == $this->valid_client_id && $username == 'adirkuhn' && $password == '666' ) {
31                        //return true;
32                        return array('scope' => 'all');
33                }
34                else {
35                        return false;
36                }
37        }
38
39        public function checkClientCredentials($client_id, $client_secret = NULL) {
40        }
41
42        public function getClientDetails($client_id) {
43        }
44
45        public function getAccessToken($oauth_token) {
46        }
47
48       
49        public function setAccessToken($oauth_token, $client_id, $user_id, $expires, $scope = NULL) {
50                var_dump(func_get_args());
51        }
52
53       
54        public function checkRestrictedGrantType($client_id, $grant_type) {
55                if($client_id == $this->valid_client_id && $grant_type == 'password') {
56                        return true;
57                }
58                else {
59                        return false;
60                }
61        }
62
63
64        public function getRefreshToken($refresh_token) {
65        }
66
67       
68        public function setRefreshToken($refresh_token, $client_id, $user_id, $expires, $scope = NULL) {
69        }
70
71
72        public function unsetRefreshToken($refresh_token) {
73        }
74
75}
76
77
Note: See TracBrowser for help on using the repository browser.