<?php

namespace AuthStack\OAuth2;

abstract class OAuth2Constants
{
    // Authorization Code
    const RESP_TYPE_CODE = 'code';

    // Implicit grant type requires this one
    const RESP_TYPE_TOKEN = 'token';

    // The value says it all :)
    const RESP_TYPE_NONE = 'none';

    // Password credentials grant type
    const GRANT_TYPE_PWD = 'password';

    // Client credentials grant type
    const GRANT_TYPE_CREDS = 'client_credentials';

    // Used by Token Request
    const GRANT_TYPE_AUTH_CODE = 'authorization_code';

    // Implicit grant type
    const GRANT_TYPE_IMPLICIT = 'implicit';

    //
    const GRANT_TYPE_REFRESH_TOKEN = 'refresh_token';

    // The JWT Bearer Token Grant Type defined in OAuth JWT Bearer Token Profiles
    // [RFC7523] https://tools.ietf.org/html/rfc7523
    const GRANT_TYPE_JWT_BEARER = 'urn:ietf:params:oauth:grant-type:jwt-bearer';

    // The SAML 2.0 Bearer Assertion Grant defined in OAuth SAML 2 Bearer Token Profiles
    //  [RFC7522] https://tools.ietf.org/html/rfc7522
    const GRANT_TYPE_SAML2_BEARER = 'urn:ietf:params:oauth:grant-type:saml2-bearer';

    const AUTH_METHOD_NONE = 'none';
    const AUTH_METHOD_POST = 'client_secret_post';
    const AUTH_METHOD_BASIC = 'client_secret_basic';

    const AUTH_METHODS_ALLOWED = [self::AUTH_METHOD_NONE, self::AUTH_METHOD_POST, self::AUTH_METHOD_BASIC];

    // Error codes
    const ERR_INVALID_REQUEST = 'invalid_request';
    const ERR_UNAUTHORIZED_CLIENT = 'unauthorized_client';
    const ERR_INVALID_CLIENT = 'invalid_client';
    const ERR_ACCESS_DENIED = 'access_denied';
    const ERR_UNSUPPORTED_RESP_TYPE = 'unsupported_response_type';
    const ERR_INVALID_SCOPE = 'invalid_scope';
    const ERR_SERVER_ERROR = 'server_error';
    const ERR_TEMPORARILY_UNAVAILABLE = 'temporarily_unavailable';

}