Convert extended usages from Bouncy Castle.

@param usages the bouncy castle extended key usage to convert.
@return the set of authorized usages.
972008
public static ExtendedKeyUsages getExtendedKeyUsages(ExtendedKeyUsage usages)
    {
        if (usages == null) {
            return null;
        }

        List<String> usageStr = new ArrayList<String>();

        for (KeyPurposeId keyPurposeId : usages.getUsages()) {
            usageStr.add(keyPurposeId.getId());
        }

        return new ExtendedKeyUsages(usageStr);
    }
727833
public Set<String> getExpandedRows() {
		Set<String> keys = getComponentModel().expandedRows;
		if (keys == null) {
			return Collections.emptySet();
		} else {
			return Collections.unmodifiableSet(keys);
		}
	}
1277781
public Usages getSubscriptionUsages(final String subscriptionCode, final String addOnCode, final QueryParams params) {
       return doGET(Subscription.SUBSCRIPTION_RESOURCE +
                        "/" +
                        subscriptionCode +
                        AddOn.ADDONS_RESOURCE +
                        "/" +
                        addOnCode +
                        Usage.USAGE_RESOURCE, Usages.class, params );
    }
1189681
private Set<CacheKey> getCacheKeys() {
        Set<CacheKey> cacheKeys = new HashSet<CacheKey>();
        Applications apps = registry.getApplicationsFromLocalRegionOnly();
        for (Application app : apps.getRegisteredApplications()) {
            for (InstanceInfo instanceInfo : app.getInstances()) {
                String localAccountId = getAccountId(instanceInfo, accountId);
                String asgName = instanceInfo.getASGName();
                if (asgName != null) {
                    CacheKey key = new CacheKey(localAccountId, asgName);
                    cacheKeys.add(key);
                }
            }
        }

        return cacheKeys;
    }
997049
public Set<String> getActivitiesWithRoutingConstraints(){
		Set<String> result = new HashSet<>();
		String propertyValue = getProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS);
		if(propertyValue == null)
			return result;
		StringTokenizer activityTokens = StringUtils.splitArrayString(propertyValue, " ");
		while(activityTokens.hasMoreTokens()){
			result.add(activityTokens.nextToken());
		}
		return result;
	}
61085
public Collection<GrantedAuthority> getAuthorities() {
        Set<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();
        for (Role role : Role.ROLE_USER.getRoleHierarchy()) {
            authorities.add(new SimpleGrantedAuthority(role.name()));
        }

        if (accountRights != null) {
            for (AccountRights rights : accountRights) {
                Set<Role> roles = rights.getRoles();
                if (roles != null) {
                    for (Role role : roles) {
                        authorities.add(role.authority());
                    }
                }
            }
        }

        if (isRoot()) {
            authorities.add(new SimpleGrantedAuthority(Role.ROLE_ROOT.name()));
        }
        return authorities;
    }
927358
public List<byte[]> getAuthorizations() {
        ArrayList<byte[]> copy = new ArrayList<byte[]>(authsList.size());
        for (byte[] auth : authsList) {
            byte[] bytes = new byte[auth.length];
            System.arraycopy(auth, 0, bytes, 0, auth.length);
            copy.add(bytes);
        }
        return Collections.unmodifiableList(copy);
    }
235026
static int getUsageIndex(DSAKeyValidationParameters.Usage usage)
    {
        if (usage == DSAKeyValidationParameters.Usage.DIGITAL_SIGNATURE) {
            return DSAParameterGenerationParameters.DIGITAL_SIGNATURE_USAGE;
        } else if (usage == DSAKeyValidationParameters.Usage.KEY_ESTABLISHMENT) {
            return DSAParameterGenerationParameters.KEY_ESTABLISHMENT_USAGE;
        }
        return -1;
    }
134519
public ServiceBroker use(Collection<Middleware> middlewares) {
		if (serviceRegistry == null) {

			// Apply middlewares later
			this.middlewares.addAll(middlewares);
		} else {

			// Apply middlewares now
			serviceRegistry.use(middlewares);
		}
		return this;
	}
1268422
static Key[] toNativeKeys(List<DatastoreKey> keys) {
    Key[] nativeKeys = new Key[keys.size()];
    for (int i = 0; i < keys.size(); i++) {
      nativeKeys[i] = keys.get(i).nativeKey();
    }
    return nativeKeys;
  }
1184165
public RequestLimitRule matchingKeys(String... keys) {
        Set<String> keySet = keys.length > 0 ? new HashSet<>(Arrays.asList(keys)) : null;
        return matchingKeys(keySet);
    }
791075
@RequestMapping(value = "actions", method = RequestMethod.GET)
    public Resources<Action> getAccountMgtActions() {
        return Resources.of(
                extensionManager.getExtensions(AccountMgtActionExtension.class).stream()
                        .map(this::resolveExtensionAction)
                        .filter(action -> action != null),
                uri(on(AccountController.class).getAccountMgtActions())
        );
    }
831841
public static List<String> getExtendedKeyUsage(X509Certificate cert)
        throws CertificateParsingException {
        try {
            byte[] ext = cert.getExtensionValue(EXTENDED_KEY_USAGE_OID);
            if (ext == null)
                return null;
            DerValue val = new DerValue(ext);
            byte[] data = val.getOctetString();

            ExtendedKeyUsageExtension ekuExt =
                new ExtendedKeyUsageExtension(Boolean.FALSE, data);
            return Collections.unmodifiableList(ekuExt.getExtendedKeyUsage());
        } catch (IOException ioe) {
            throw new CertificateParsingException(ioe);
        }
    }
909607
public function canBeUsedFor(string $usage) : bool
    {
        if (!in_array($usage, static::getValidKeyUsages(), true)) {
            throw new InvalidKeyUsageException($usage);
        }

        return isset($this->keyData[$usage]) && $this->keyData[$usage];
    }
142291
@JsonIgnore
	public Collection<? extends GrantedAuthority> getAuthorities() {
		if (user.isAdmin()) {
			return Collections.singleton(new SimpleGrantedAuthority(Roles.ADMIN.toString()));
		} else if (user.isModerator()) {
			return Collections.singleton(new SimpleGrantedAuthority(Roles.MOD.toString()));
		} else {
			return Collections.singleton(new SimpleGrantedAuthority(Roles.USER.toString()));
		}
	}
981993
def key_usage(self):
        """"""
        try:
            ext = self.x509.extensions.get_extension_for_oid(ExtensionOID.KEY_USAGE)
        except x509.ExtensionNotFound:
            return None
        return KeyUsage(ext)
676464
protected function validate($usage, array $usages)
    {
        if (!in_array($usage, $usages)) {
            throw new InvalidArgumentException(
                '['.$usage.'] is not a valid cache usage. Available: '.implode(', ', array_keys($this->usages))
            );
        }

        return $usage;
    }