Adds a Grant that the provider should support.

        :param grant: An instance of a class that extends
                      :class:`oauth2.grant.GrantHandlerFactory`
        :type grant: oauth2.grant.GrantHandlerFactory
517525
def add_grant(self, grant):
        
        if hasattr(grant, "expires_in"):
            self.token_generator.expires_in[grant.grant_type] = grant.expires_in

        if hasattr(grant, "refresh_expires_in"):
            self.token_generator.refresh_expires_in = grant.refresh_expires_in

        self.grant_types.append(grant)
569646
def grant_authority(self, column=None, value=None, **kwargs):
        """"""
        return self._resolve_call('GIC_GRANT_AUTH', column, value, **kwargs)
321441
def addHandler(name, basepath=None, baseurl=None, allowDownscale=False):
    """"""
    if basepath is None:
        basepath = '.'
    _handlers.append(_handler_classes[name](basepath, baseurl, allowDownscale))
339287
def auth_add(name, service, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('auth:group:members:add', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
        'service': service,
    })
643233
void grant(SchemaObject object, Right right, Grantee grantor,
               boolean withGrant) {

        final HsqlName name            = object.getName();
        final Right    grantableRights = grantor.getAllGrantableRights(object);
        Right          existingRight   = null;

        if (right == Right.fullRights) {
            if (grantableRights.isEmpty()) {
                return;    // has no rights
            }

            right = grantableRights;
        } else {
            if (!grantableRights.contains(right)) {
                throw Error.error(ErrorCode.X_0L000);
            }
        }

        Iterator it = directRightsMap.get(name);

        while (it.hasNext()) {
            Right existing = (Right) it.next();

            if (existing.grantor == grantor) {
                existingRight = existing;

                existingRight.add(right);

                break;
            }
        }

        if (existingRight == null) {
            existingRight         = right.duplicate();
            existingRight.grantor = grantor;
            existingRight.grantee = this;

            directRightsMap.put(name, existingRight);
        }

        if (withGrant) {
            if (existingRight.grantableRights == null) {
                existingRight.grantableRights = right.duplicate();
            } else {
                existingRight.grantableRights.add(right);
            }
        }

        if (!grantor.isSystem) {

            // based on assumption that there is no need to access
            grantor.grantedRightsMap.put(name, existingRight);
        }

        updateAllRights();
    }
673119
def grant_admin_role(self):
    
    apiuser = ApiUser(self._get_resource_root(), self.name, roles=['ROLE_ADMIN'])
    return self._put('', ApiUser, data=apiuser)
707673
def add(self, ipaddr=None, proto=None, port=None, fields=None):
        
        return self.send.service_add(ipaddr, proto, port, fields)
879985
def _on_grant(self, grant):
        '''
        
        '''
        self.set_timeout(grant.expiration_time, ContractState.expired,
                         self._run_and_terminate, self.contractor.cancelled,
                         grant)

        self.grant = grant
        # this is necessary for nested contracts to work with handing
        # the messages over
        self.set_remote_id(grant.sender_id)
        self.update_manager_address(grant.reply_to)

        self.call_agent_side(self.contractor.granted, grant,
                             ensure_state=ContractState.granted)
788792
def grant_user_access(self, instance, user, db_names, strict=True):
        
        return instance.grant_user_access(user, db_names, strict=strict)
285465
def _access_token_endpoint(self, grantType, extraParams={}):
        
        response = requests.post(
            self._format_url(OAUTH2_ROOT + 'access_token'),
            data = _extend({
                'grant_type': grantType,
                'client_id': self.client.get('client_id', ''),
                'client_secret': self.client.get('client_secret', ''),
                'redirect_uri': self.client.get('redirect_uri', '')
            }, extraParams))
        
        data = response.json()
        if 'error' in data or 'error_description' in data:
            raise _token_error_from_data(data)
        else:
            return self.set_creds(data)
1338685
public function allowGrantType($grantType)
    {
        if ($grantType instanceof IGrantType) {
            $this->grantTypes[] = get_class($grantType);
        } else if (is_string($grantType) && class_exists($grantType) && is_subclass_of($grantType, 'OAuth2\\GrantType\\IGrantType')) {
            $this->grantTypes[] = $grantType;
        } else {
            throw new \InvalidArgumentException(
                "Grant type has to be fully qualified class name or instance of OAuth2\\GrantType\\IGrantType."
            );
        }
    }
520814
private static void addAclHeaders(Request<? extends AmazonWebServiceRequest> request, AccessControlList acl) {
        List<Grant> grants = acl.getGrantsAsList();
        Map<Permission, Collection<Grantee>> grantsByPermission = new HashMap<Permission, Collection<Grantee>>();
        for ( Grant grant : grants ) {
            if ( !grantsByPermission.containsKey(grant.getPermission()) ) {
                grantsByPermission.put(grant.getPermission(), new LinkedList<Grantee>());
            }
            grantsByPermission.get(grant.getPermission()).add(grant.getGrantee());
        }
        for ( Permission permission : Permission.values() ) {
            if ( grantsByPermission.containsKey(permission) ) {
                Collection<Grantee> grantees = grantsByPermission.get(permission);
                boolean seenOne = false;
                StringBuilder granteeString = new StringBuilder();
                for ( Grantee grantee : grantees ) {
                    if ( !seenOne )
                        seenOne = true;
                    else
                        granteeString.append(", ");
                    granteeString.append(grantee.getTypeIdentifier()).append("=").append("\"")
                            .append(grantee.getIdentifier()).append("\"");
                }
                request.addHeader(permission.getHeaderName(), granteeString.toString());
            }
        }
    }
946557
def grant_role(self, role_name, principal_name, principal_type, grantor, grantorType, grant_option):
    
    self.send_grant_role(role_name, principal_name, principal_type, grantor, grantorType, grant_option)
    return self.recv_grant_role()
833921
private static boolean isGrantTypeSupported(final String type, final OAuth20GrantTypes... expectedTypes) {
        LOGGER.debug("Grant type received: [{}]", type);
        for (val expectedType : expectedTypes) {
            if (OAuth20Utils.isGrantType(type, expectedType)) {
                return true;
            }
        }
        LOGGER.error("Unsupported grant type: [{}]", type);
        return false;
    }
204699
def add_token(self, token, token_handler, request):
        
        # Only add a hybrid access token on auth step if asked for
        if not request.response_type in ["token", "code token", "id_token token", "code id_token token"]:
            return token

        token.update(token_handler.create_token(request, refresh_token=False))
        return token
760423
def access_grant(tp, name, cid, uid, perm, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('access:edit:grant', **{
        'unicat': ctx.repo.create_secure_service('unicat'),
        'tp': tp,
        'name': name,
        'cids': cid,
        'uids': uid,
        'perm': perm,
    })
262186
def extend_access_token(self, app_id, app_secret):
        
        args = {
            "client_id": app_id,
            "client_secret": app_secret,
            "grant_type": "fb_exchange_token",
            "fb_exchange_token": self.access_token,
        }

        return self.request(
            "{0}/oauth/access_token".format(self.version), args=args
        )