io.cattle.platform.core.model.Account.getExternalIdType()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中io.cattle.platform.core.model.Account.getExternalIdType()方法的一些代码示例,展示了Account.getExternalIdType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Account.getExternalIdType()方法的具体详情如下:
包路径:io.cattle.platform.core.model.Account
类名称:Account
方法名:getExternalIdType

Account.getExternalIdType介绍

[英]Getter for cattle.account.external_id_type.
[中]cattle.account.external_id_type的Getter。

代码示例

代码示例来源:origin: rancher/cattle

@Override
public Resource filter(ApiRequest request, Object original, Resource converted) {
  IdFormatter idFormatter = ApiContext.getContext().getIdFormatter();
  Identity identity = null;
  if (original instanceof Account) {
    Account account = (Account) original;
    if (AccountConstants.PROJECT_KIND.equalsIgnoreCase(account.getKind())) {
      return converted;
    }
    if (account.getExternalId() != null && account.getExternalIdType() != null) {
      identity = new Identity(account.getExternalIdType(), account.getExternalId());
    } else {
      if (!AccountConstants.PROJECT_KIND.equalsIgnoreCase(account.getKind())) {
        identity = new Identity(ProjectConstants.RANCHER_ID, String.valueOf(account.getId()));
      }
    }
  }
  if (identity != null) {
    if (idFormatter != null) {
      converted.getFields().put("identity", idFormatter.formatId("identity", identity.getId()));
    } else {
      converted.getFields().put("identity", identity.getId());
    }
  }
  return converted;
}

代码示例来源:origin: rancher/cattle

@Override
public void deleteProjectMemberEntries(Account account) {
  if (!ProjectConstants.TYPE.equalsIgnoreCase(account.getKind())
      && StringUtils.isNotBlank(account.getExternalId())
      && StringUtils.isNotBlank(account.getExternalIdType())){
    create().delete(PROJECT_MEMBER)
        .where(PROJECT_MEMBER.EXTERNAL_ID.eq(account.getExternalId())
            .and(PROJECT_MEMBER.EXTERNAL_ID_TYPE.eq(account.getExternalIdType())))
        .execute();
  }
  create().delete(PROJECT_MEMBER)
    .where(PROJECT_MEMBER.PROJECT_ID.eq(account.getId()))
    .execute();
}

代码示例来源:origin: rancher/cattle

@Override
public Set<Identity> getIdentities(Account account) {
  if (!isConfigured() ||
      !AzureConstants.USER_SCOPE.equalsIgnoreCase(account.getExternalIdType())) {
    return new HashSet<>();

代码示例来源:origin: rancher/cattle

} else if(ServiceAuthConstants.NO_IDENTITY_LOOKUP_SUPPORTED.get()) {
  Set<Identity> identities = new HashSet<>();
  if (StringUtils.equals(account.getExternalIdType(), ServiceAuthConstants.USER_TYPE.get())) {
    identities.add(new Identity(account.getExternalIdType(), account.getExternalId(), null, null, null, null, true));

代码示例来源:origin: rancher/cattle

@Override
public Set<Identity> getIdentities(Account account) {
  if (!isConfigured() || !getConstantsConfig().getUserScope().equalsIgnoreCase(account.getExternalIdType())) {
    return new HashSet<>();
  }
  if(!getTokenUtils().findAndSetJWT() &&
      SecurityConstants.SECURITY.get() &&
      getConstantsConfig().getConfig().equalsIgnoreCase(SecurityConstants.AUTH_PROVIDER.get())) {
    AuthToken authToken = authTokenDao.getTokenByAccountId(account.getId());
    if (authToken == null){
      LdapName dn;
      try {
        dn = new LdapName(account.getExternalId());
      } catch (NamingException e) {
        throw new ClientVisibleException(ResponseCodes.UNAUTHORIZED);
      }
      Set<Identity> identities = getIdentities(dn);
      Token token = getTokenUtils().createToken(identities, null);
      authToken = authTokenDao.createToken(token.getJwt(), getConstantsConfig().getConfig(), account.getId(), account.getId());
    }
    if (authToken != null && authToken.getKey() != null) {
      ApiRequest request = ApiContext.getContext().getApiRequest();
      request.setAttribute(getConstantsConfig().getJWTType(), authToken.getKey());
    }
  }
  return getTokenUtils().getIdentities();
}

代码示例来源:origin: rancher/cattle

/**
 * {@inheritDoc}
 */
@Override
public void from(io.cattle.platform.core.model.Account from) {
  setId(from.getId());
  setName(from.getName());
  setKind(from.getKind());
  setUuid(from.getUuid());
  setDescription(from.getDescription());
  setState(from.getState());
  setCreated(from.getCreated());
  setRemoved(from.getRemoved());
  setRemoveTime(from.getRemoveTime());
  setData(from.getData());
  setExternalId(from.getExternalId());
  setExternalIdType(from.getExternalIdType());
  setHealthState(from.getHealthState());
  setProjectTemplateId(from.getProjectTemplateId());
  setDefaultNetworkId(from.getDefaultNetworkId());
  setVersion(from.getVersion());
  setRevision(from.getRevision());
}

相关文章