HTML and CSS Reference
In-Depth Information
// Makes sure the session is started
if (!session_id()) {
session_start();
}
/**
* An abstract class for handling the basics of OAuth 2.0 authorization
*
* @author Jason Lengstorf
* @copyright 2012 Jason Lengstorf
*/
abstract class RWA_OAuth
{
}
Because using OAuth requires the app to request external uRis to function properly, the
cURL
extension is
required. this script uses
extension_loaded()
to verify that
cURL
support is available, or
throw
s an
Exception
if not.
■
Note
it's possible to work around lack of
cURL
support,
4
but that's outside the scope of this exercise.
next, it checks for an active session id and starts a session if none is found.
the class is called
RWA_OAuth
(there may be other classes that are called “OAuth” so the
RWA_
prefix is used to
prevent class naming conflicts ). it's abstract, which means that it cannot be instantiated directly; in other words,
another class must extend
RWA_OAuth
before its methods and properties can be accessed.
Class properties
With the class declared, we can now define all the class properties:
abstract class RWA_OAuth
{
/**
* The service's auth endpoint
* @var string
*/
public $service_auth_endpoint,
4
Search WWH ::
Custom Search