Sets the access flags to identify the given principal type.<p>

@param principal the principal to set the flags for
346140
public void setFlagsForPrincipal(I_CmsPrincipal principal) {

        setFlags(
            principal.isGroup() ? CmsAccessControlEntry.ACCESS_FLAGS_GROUP : CmsAccessControlEntry.ACCESS_FLAGS_USER);
    }
631864
@Override
	public SecuritySetter<HttpURLConnection> basicAuthSS(BasicPrincipal principal) throws CadiException {
		try {
			return new HBasicAuthSS(principal,si);
		} catch (IOException e) {
			throw new CadiException("Error creating HBasicAuthSS",e);
		}
	}
1260738
public void setInboundPermissionAuthorizations(java.util.Collection<IpPermission> inboundPermissionAuthorizations) {
        if (inboundPermissionAuthorizations == null) {
            this.inboundPermissionAuthorizations = null;
            return;
        }

        this.inboundPermissionAuthorizations = new java.util.ArrayList<IpPermission>(inboundPermissionAuthorizations);
    }
1160774
@JsonIgnore
    protected Map<String, List<Object>> getPrincipalAttributes(final Principal principal) {
        if (ignoreResolvedAttributes) {
            return new HashMap<>(0);
        }
        return convertPrincipalAttributesToPersonAttributes(principal.getAttributes());
    }
1114719
public void setCertificateAuthorities(java.util.Collection<CertificateAuthority> certificateAuthorities) {
        if (certificateAuthorities == null) {
            this.certificateAuthorities = null;
            return;
        }

        this.certificateAuthorities = new java.util.ArrayList<CertificateAuthority>(certificateAuthorities);
    }
248135
protected Principal getAccessTokenAuthenticationPrincipal(final AccessToken accessToken, final J2EContext context, final RegisteredService registeredService) {
        val currentPrincipal = accessToken.getAuthentication().getPrincipal();
        LOGGER.debug("Preparing user profile response based on CAS principal [{}]", currentPrincipal);

        val principal = this.scopeToAttributesFilter.filter(accessToken.getService(), currentPrincipal, registeredService, context, accessToken);
        LOGGER.debug("Created CAS principal [{}] based on requested/authorized scopes", principal);

        return principal;
    }
644110
private void setSsoTokenCredential(Subject subject, String principalAccessId)
                    throws CredentialException {
        try {
            TokenManager tokenManager = tokenManagerRef.getService();
            SingleSignonToken ssoToken = null;
            Set<Token> tokens = subject.getPrivateCredentials(Token.class);
            if (tokens.isEmpty() == false) {
                Token ssoLtpaToken = tokens.iterator().next();
                subject.getPrivateCredentials().remove(ssoLtpaToken);
                ssoToken = tokenManager.createSSOToken(ssoLtpaToken);
            } else {
                Map<String, Object> tokenData = new HashMap<String, Object>();
                tokenData.put("unique_id", principalAccessId);
                ssoToken = tokenManager.createSSOToken(tokenData);
            }

            subject.getPrivateCredentials().add(ssoToken);
        } catch (TokenCreationFailedException e) {
            throw new CredentialException(e.getLocalizedMessage());
        }
    }
449902
private static boolean isTicketGrantingServerPrincipal(KerberosPrincipal principal)
    {
        if (principal == null) {
            return false;
        }
        if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) {
            return true;
        }
        return false;
    }
620761
@Override
   public Boolean apply(Principal obj)
   {
	   if (this == obj)
			return Boolean.TRUE;
		if (obj == null)
			return Boolean.FALSE;
		if (!SecurityGroup.class.isAssignableFrom(obj.getClass()))
			return Boolean.FALSE;
		
		SecurityGroup other = (SecurityGroup) obj;

		return Boolean.valueOf(this.name.equals(other.getName()));
   }
697892
public void setAcePrincipalId(String acePrincipalId) {

        try {
            CmsUUID principalId = null;
            String principal = acePrincipalId.substring(acePrincipalId.indexOf('.') + 1, acePrincipalId.length());
            if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_GROUP)) {
                principal = OpenCms.getImportExportManager().translateGroup(principal);
                principalId = getCms().readGroup(principal).getId();
            } else if (acePrincipalId.startsWith(I_CmsPrincipal.PRINCIPAL_USER)) {
                principal = OpenCms.getImportExportManager().translateUser(principal);
                principalId = getCms().readUser(principal).getId();
            } else if (acePrincipalId.startsWith(CmsRole.PRINCIPAL_ROLE)) {
                principalId = CmsRole.valueOfRoleName(principal).getId();
            } else if (acePrincipalId.equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_NAME)) {
                principalId = CmsAccessControlEntry.PRINCIPAL_ALL_OTHERS_ID;
            } else if (acePrincipalId.equalsIgnoreCase(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_NAME)) {
                principalId = CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID;
            } else {
                if (LOG.isWarnEnabled()) {
                    LOG.warn(
                        Messages.get().getBundle().key(
                            Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_ACE_1,
                            acePrincipalId));
                }
                throw new CmsIllegalStateException(
                    Messages.get().container(Messages.LOG_IMPORTEXPORT_ERROR_IMPORTING_ACE_1, acePrincipalId));
            }
            m_acePrincipalId = principalId;
        } catch (Throwable e) {
            setThrowable(e);
        }
    }
276154
@Override
    public IPermission newPermission(String owner, IAuthorizationPrincipal principal) {
        IPermission p = getPermissionStore().newInstance(owner);
        if (principal != null) {
            String pString = getPrincipalString(principal);
            p.setPrincipal(pString);
        }
        return p;
    }
29723
public void setPrincipals(java.util.Collection<SharePrincipal> principals) {
        if (principals == null) {
            this.principals = null;
            return;
        }

        this.principals = new java.util.ArrayList<SharePrincipal>(principals);
    }
244532
public void launchAddPrincipalDialog(final Principal.Type type) {
        PrincipalDialog dialog = new PrincipalDialog(type, accessControlStore, circuit, this);
        openWindow(type == Principal.Type.USER ? Console.MESSAGES.addUserToRole() :
                Console.MESSAGES.addGroupToRole(), WINDOW_WIDTH, 250, dialog);
    }
153203
private final void setFlags() {
    if (gotFlags) {
      jmo.setField(ControlAccess.FLAGS, Byte.valueOf(flags));
      gotFlags = false;
    }
  }
1291034
@Override
    public Principal getUserPrincipal() {
        ServletRESTRequestImpl ret = castRequest();
        if (ret != null)
            return ret.getUserPrincipal();
        return null;
    }
303910
@Override
    public void setRoles(List<RoleEntity> inRoles) {
        if (inRoles == null) {
            this.roles = new ArrayList<>();
        } else {
            this.roles = new ArrayList<>(inRoles);
        }
        this.roles = inRoles;
    }
751265
void onSelect() {

        if (m_selectHandler != null) {
            String principalType = (String)m_principalTypeSelect.getValue();
            if (CmsVaadinUtils.getMessageText(org.opencms.workplace.commons.Messages.GUI_LABEL_ROLE_0).equals(
                principalType)) {
                principalType = CmsRole.PRINCIPAL_ROLE;
            }
            m_selectHandler.onPrincipalSelect(principalType, m_principalName.getValue());
        }
    }