Sets the audience scope to use with Google Cloud Endpoints.

@param context context
@param audience audience
@return new instance
167675
public static GoogleAccountCredential usingAudience(Context context, String audience) {
    Preconditions.checkArgument(audience.length() != 0);
    return new GoogleAccountCredential(context, "audience:" + audience);
  }
499292
protected void configureMessageEndpoint(ApplicationContext context) {
        if (context.containsBean(MESSAGE_ENDPOINT_BEAN_NAME)) {
            WebServiceEndpoint messageEndpoint = context.getBean(MESSAGE_ENDPOINT_BEAN_NAME, WebServiceEndpoint.class);

            EndpointAdapter endpointAdapter = webServiceServer.getEndpointAdapter();
            if (endpointAdapter != null) {
                messageEndpoint.setEndpointAdapter(endpointAdapter);
            }

            WebServiceEndpointConfiguration endpointConfiguration = new WebServiceEndpointConfiguration();
            endpointConfiguration.setHandleMimeHeaders(webServiceServer.isHandleMimeHeaders());
            endpointConfiguration.setHandleAttributeHeaders(webServiceServer.isHandleAttributeHeaders());
            endpointConfiguration.setKeepSoapEnvelope(webServiceServer.isKeepSoapEnvelope());
            endpointConfiguration.setMessageConverter(webServiceServer.getMessageConverter());
            messageEndpoint.setEndpointConfiguration(endpointConfiguration);

            if (StringUtils.hasText(webServiceServer.getSoapHeaderNamespace())) {
                messageEndpoint.setDefaultNamespaceUri(webServiceServer.getSoapHeaderNamespace());
            }

            if (StringUtils.hasText(webServiceServer.getSoapHeaderPrefix())) {
                messageEndpoint.setDefaultPrefix(webServiceServer.getSoapHeaderPrefix());
            }
        }
    }
811344
public static void putTicketGrantingTicketInScopes(final RequestContext context, final TicketGrantingTicket ticket) {
        val ticketValue = ticket != null ? ticket.getId() : null;
        putTicketGrantingTicketInScopes(context, ticketValue);
    }
1049092
public static synchronized void sendBroadcast(final Context context, final Intent intent) {
		final String action = intent.getAction();
		final Set<BroadcastReceiver> receivers = ACTIONS.get(action);

		if (receivers != null) {
			for (final BroadcastReceiver receiver : receivers) {
				BROADCASTS.add(new Broadcast(receiver, intent));
			}
			notifyMessageHandler(context);
		}
	}
702274
public OkVolley init(Context context) {
        this.mContext = context;
        InstanceRequestQueue = newRequestQueue(context);
        mUserAgent = generateUserAgent(context);
        mRequestHeaders = new HashMap<>();
        mRequestHeaders.put(OkRequest.HEADER_USER_AGENT, mUserAgent);
        mRequestHeaders.put(OkRequest.HEADER_ACCEPT_CHARSET, OkRequest.CHARSET_UTF8);
        return this;
    }
68085
protected MessageChannel getDestinationChannel(TestContext context) {
        if (endpointConfiguration.getChannel() != null) {
            return endpointConfiguration.getChannel();
        } else if (StringUtils.hasText(endpointConfiguration.getChannelName())) {
            return resolveChannelName(endpointConfiguration.getChannelName(), context);
        } else {
            throw new CitrusRuntimeException("Neither channel name nor channel object is set - " +
                    "please specify destination channel");
        }
    }
109126
public static synchronized MCAAuthorizationManager createInstance(Context context) {
        if (instance == null) {
            instance = new MCAAuthorizationManager(context.getApplicationContext());

            instance.bluemixRegionSuffix = BMSClient.getInstance().getBluemixRegionSuffix();
            instance.tenantId = BMSClient.getInstance().getBluemixAppGUID();

            AuthorizationRequest.setup();
        }
        return instance;
    }
289245
@Override
    public MonetaryAmountFactory<T> setContext(MonetaryContext monetaryContext) {
        Objects.requireNonNull(monetaryContext);
        int maxScale = getMaximalMonetaryContext().getMaxScale();
        if (maxScale != -1 && maxScale < monetaryContext.getMaxScale()) {
            throw new MonetaryException(
                    "Context exceeds maximal capabilities (scale) of this type: " + monetaryContext);
        }
        int precision = getMaximalMonetaryContext().getPrecision();
        if (precision != 0 && precision < monetaryContext.getPrecision()) {
            throw new MonetaryException(
                    "Contexts exceeds maximal capabilities (precision) of this type: " + monetaryContext);
        }
        this.monetaryContext = monetaryContext.toBuilder()
            .setAmountType(getAmountType()).build();
        return this;
    }
1050307
protected boolean isRequestAskingForServiceTicket(final RequestContext context) {
        val ticketGrantingTicketId = WebUtils.getTicketGrantingTicketId(context);
        LOGGER.debug("Located ticket-granting ticket [{}] from the request context", ticketGrantingTicketId);

        val service = WebUtils.getService(context);
        LOGGER.debug("Located service [{}] from the request context", service);

        val renewParam = getWebflowEventResolutionConfigurationContext().getCasProperties().getSso().isRenewAuthnEnabled()
            ? context.getRequestParameters().get(CasProtocolConstants.PARAMETER_RENEW)
            : StringUtils.EMPTY;
        LOGGER.debug("Provided value for [{}] request parameter is [{}]", CasProtocolConstants.PARAMETER_RENEW, renewParam);

        if (service != null && StringUtils.isNotBlank(ticketGrantingTicketId)) {
            val authn = getWebflowEventResolutionConfigurationContext().getTicketRegistrySupport().getAuthenticationFrom(ticketGrantingTicketId);
            if (StringUtils.isNotBlank(renewParam)) {
                LOGGER.debug("Request identifies itself as one asking for service tickets. Checking for authentication context validity...");
                val validAuthn = authn != null;
                if (validAuthn) {
                    LOGGER.debug("Existing authentication context linked to ticket-granting ticket [{}] is valid. "
                        + "CAS should begin to issue service tickets for [{}] once credentials are renewed", ticketGrantingTicketId, service);
                    return true;
                }
                LOGGER.debug("Existing authentication context linked to ticket-granting ticket [{}] is NOT valid. "
                        + "CAS will not issue service tickets for [{}] just yet without renewing the authentication context",
                    ticketGrantingTicketId, service);
                return false;
            }
        }

        LOGGER.debug("Request is not eligible to be issued service tickets just yet");
        return false;
    }
581711
public static void injectContextProxies(AbstractResourceInfo cri, Object instance) {
        injectContextProxiesAndApplication(cri, instance, null, null);
    }
1202841
public void prepareEndPoint(CFEndPointImpl endpoint) throws ChannelFrameworkException {
        if (null == endpoint.getOutboundChainData()) {
            VirtualConnectionFactory vcf = getOutboundVCFactory(endpoint.getOutboundChannelDefs());
            endpoint.setOutboundVCFactory(vcf);
            endpoint.setOutboundChainData(getChain(vcf.getName()));
        }
    }
1088297
def check_correct_audience(self, audience):
        ""
        client_id, _ = self.get_key_and_secret()
        if audience != client_id:
            raise AuthException('Wrong audience')
63122
public void changeScope(@Nullable final ThreadDelegatedContext context)
    {
        final ThreadDelegatedContext oldContext = threadLocal.get();
        if (oldContext != null) {
            if (oldContext == context) {
                // If the context gets exchanged with itself, do nothing.
                return;
            }
            else {
                // This must not clear the context. It might still be
                // referenced by another thread.
                oldContext.event(ScopeEvent.LEAVE);
            }
        }

        if (context != null) {
            threadLocal.set(context);
            context.event(ScopeEvent.ENTER);
        }
        else {
            threadLocal.remove();
        }
    }
224142
def call
      audiences = [merge_icon(list: privacy_hash(privacy_symbol: :public),
                              icon: "fa-globe")]

      audiences << merge_icon(list: privacy_hash(privacy_symbol: :circles),
                              icon: "fa-google-circles")

      # TODO: may use the avatar for the user
      audiences.concat(merge_icon(list: person_list, icon: "fa-user"))

      audiences.concat(merge_icon(list: audience_list(type: :circles),
                                  icon: "fa-google-circles"))

      audiences.concat(merge_icon(list: audience_list(type: :groups),
                                  icon: "fa-users"))
    end
160770
public static void setOptOut(final Context context, boolean optOut) {
        SharedPreferences pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
        Editor editor = pref.edit();
        editor.putBoolean(KEY_OPT_OUT, optOut);
        editor.apply();
    }
254030
public static void putUnauthorizedRedirectUrlIntoFlowScope(final RequestContext context, final URI url) {
        context.getFlowScope().put(PARAMETER_UNAUTHORIZED_REDIRECT_URL, url);
    }
1243907
def authorize(self, client_id, audience=None, state=None, redirect_uri=None,
                  response_type='code', scope='openid'):
        
        params = {
            'client_id': client_id,
            'audience': audience,
            'response_type': response_type,
            'scope': scope,
            'state': state,
            'redirect_uri': redirect_uri
        }

        return self.get(
            'https://{}/authorize'.format(self.domain),
            params=params)