Class MidPointPrincipal
java.lang.Object
com.evolveum.midpoint.security.api.MidPointPrincipal
- All Implemented Interfaces:
- DebugDumpable,- ShortDumpable,- Serializable,- org.springframework.security.core.userdetails.UserDetails
- Direct Known Subclasses:
- GuiProfiledPrincipal
public class MidPointPrincipal
extends Object
implements org.springframework.security.core.userdetails.UserDetails, DebugDumpable, ShortDumpable
Simple midPoint principal. This principal should contain only the concepts that are
 essential for midPoint core to work. It should not contain user interface concepts
 (e.g. adminGuiConfig). For that see GuiProfiledPrincipal.
- Author:
- Radovan Semancik
- See Also:
- 
Field SummaryFields inherited from interface com.evolveum.midpoint.util.DebugDumpableINDENT_STRING
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedMidPointPrincipal(@NotNull FocusType focus) Use static factory methods when calling from the outside.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddAuthorization(@NotNull Authorization authorization) Use only during "regular" building or updating of a principal.voidaddDelegationTarget(@NotNull PrismObject<? extends AssignmentHolderType> target, OtherPrivilegesLimitations.Limitation limitation) Registers an information about "membership delegation", i.e.voidaddExtraAuthorizationIfMissing(@NotNull Authorization authorization, boolean full) Use to add extra authorizations - it setseffectivePrivilegesModificationflag.voidChecks if the midPoint object behind this principal is enabled.voidvoidclone()Semi-shallow clone.cloneWithAdditionalAuthorizations(@NotNull List<Authorization> additionalAuthorizations, boolean full) SetseffectivePrivilegesModificationflag if needed.protected voidcopyValues(MidPointPrincipal clone) static MidPointPrincipalReturns a principal without authorizations.debugDump(int indent) protected voiddebugDumpInternal(StringBuilder sb, int indent) @Nullable FocusTypeReal identity of the logged-in user.@Nullable PrismObject<? extends FocusType>@NotNull Collection<Authorization>getDelegatedMembershipFor(OtherPrivilegesLimitations.Type limitationType) Includes the delegators themselves.getDelegatorsFor(OtherPrivilegesLimitations.Type limitationType) TODO (null means we don't care about limitations)@Nullable EffectivePrivilegesModificationType@NotNull FocusTypegetFocus()Effective identity that is used to execute all actions.PrismObject<? extends FocusType>@Nullable LocaleSearch for locale for this principal in multiple locations, returns first non-null item.getName()getOid()@NotNull OtherPrivilegesLimitationsPrincipal that was used before this principal was active.booleanbooleanbooleanbooleanstatic @NotNull MidPointPrincipalprivileged(@NotNull FocusType focus) Returns a principal with a single privileged authorization; regardless of what authorizations the focus has.voidsetApplicableSecurityPolicy(SecurityPolicyType applicableSecurityPolicy) voidsetAttorney(FocusType attorney) voidsetOrReplaceFocus(@NotNull FocusType newFocus) Must not change focus OID (at least for now).voidsetPreferredLocale(Locale preferredLocale) voidsetPreviousPrincipal(MidPointPrincipal previousPrincipal) voidShow the content of the object intended for diagnostics.@NotNull ObjectReferenceTypetoString()Methods inherited from class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.evolveum.midpoint.util.DebugDumpabledebugDump, debugDumpLazily, debugDumpLazilyMethods inherited from interface com.evolveum.midpoint.util.ShortDumpableshortDump, shortDumpLazily
- 
Constructor Details- 
MidPointPrincipalUse static factory methods when calling from the outside.
 
- 
- 
Method Details- 
privilegedReturns a principal with a single privileged authorization; regardless of what authorizations the focus has.
- 
createReturns a principal without authorizations.
- 
getAuthorities- Specified by:
- getAuthoritiesin interface- org.springframework.security.core.userdetails.UserDetails
 
- 
addAuthorizationUse only during "regular" building or updating of a principal. Does NOT seteffectivePrivilegesModificationflag.
- 
addExtraAuthorizationIfMissingpublic void addExtraAuthorizationIfMissing(@NotNull @NotNull Authorization authorization, boolean full) Use to add extra authorizations - it setseffectivePrivilegesModificationflag. The "if missing" will be (most of the time) a false positive match: . The authorization source will most probably differ between role-derived and artificial (runPrivileged) one; . Even if that would not be the case, any minor difference (like in name or description) would count as well. So, the full elevation would be signalled for the majority of cases even if the equivalent authorization was there.
- 
clearAuthorizationspublic void clearAuthorizations()
- 
getPassword- Specified by:
- getPasswordin interface- org.springframework.security.core.userdetails.UserDetails
 
- 
getUsername- Specified by:
- getUsernamein interface- org.springframework.security.core.userdetails.UserDetails
 
- 
isAccountNonExpiredpublic boolean isAccountNonExpired()- Specified by:
- isAccountNonExpiredin interface- org.springframework.security.core.userdetails.UserDetails
 
- 
isAccountNonLockedpublic boolean isAccountNonLocked()- Specified by:
- isAccountNonLockedin interface- org.springframework.security.core.userdetails.UserDetails
 
- 
isCredentialsNonExpiredpublic boolean isCredentialsNonExpired()- Specified by:
- isCredentialsNonExpiredin interface- org.springframework.security.core.userdetails.UserDetails
 
- 
isEnabledpublic boolean isEnabled()- Specified by:
- isEnabledin interface- org.springframework.security.core.userdetails.UserDetails
 
- 
getFocusEffective identity that is used to execute all actions. Authorizations of this identity will be applied. This is usually the logged-in user. However, this may be the user on behalf who are the actions executed (donor of power) and the real logged-in user may be the attorney.
- 
getFocusPrismObject
- 
setOrReplaceFocusMust not change focus OID (at least for now).
- 
getName
- 
getOid
- 
getEffectivePrivilegesModification
- 
clearEffectivePrivilegesModificationpublic void clearEffectivePrivilegesModification()
- 
getAttorneyReal identity of the logged-in user. Used in cases when there is a difference between logged-in user and the identity that is used to execute actions and evaluate authorizations. This may happen when one user (attorney) has switched identity to another user (donor of power). In that case the identity of the attorney is in this property. The user that was the target of the switch is stored in the "user" property.
- 
getAttorneyPrismObject
- 
setAttorney
- 
getPreviousPrincipalPrincipal that was used before this principal was active. This is used when principals are chained (e.g. attorney)
- 
setPreviousPrincipal
- 
getApplicableSecurityPolicy
- 
setApplicableSecurityPolicy
- 
cloneSemi-shallow clone.
- 
cloneWithAdditionalAuthorizationspublic MidPointPrincipal cloneWithAdditionalAuthorizations(@NotNull @NotNull List<Authorization> additionalAuthorizations, boolean full) SetseffectivePrivilegesModificationflag if needed.
- 
copyValues
- 
debugDump- Specified by:
- debugDumpin interface- DebugDumpable
 
- 
debugDumpInternal
- 
toString
- 
toObjectReference
- 
shortDumpDescription copied from interface:ShortDumpableShow the content of the object intended for diagnostics. This method is supposed to append a compact, human-readable output in a single line. Unlike toString() method, there is no requirement to identify the actual class or type of the object. It is assumed that the class/type will be obvious from the context in which the output is used.- Specified by:
- shortDumpin interface- ShortDumpable
- Parameters:
- sb- StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
 
- 
getLocaleSearch for locale for this principal in multiple locations, returns first non-null item. Order of search:- preferredLocale
- FocusType.getPreferredLanguage()
- FocusType.getLocale()
- Locale.getDefault()
 
- 
getPreferredLocale
- 
setPreferredLocale
- 
getOtherPrivilegesLimitations
- 
addDelegationTargetpublic void addDelegationTarget(@NotNull @NotNull PrismObject<? extends AssignmentHolderType> target, @NotNull OtherPrivilegesLimitations.Limitation limitation) Registers an information about "membership delegation", i.e. that this principal is a delegate of given user(s) or - indirectly - it obtains a delegated abstract role membership. The information on other privileges limitations is attached as well.
- 
getDelegatorsForTODO (null means we don't care about limitations)
- 
getDelegatedMembershipForpublic Set<String> getDelegatedMembershipFor(@Nullable OtherPrivilegesLimitations.Type limitationType) Includes the delegators themselves. Later we may extend this to full references (not only OIDs).
- 
checkEnabledChecks if the midPoint object behind this principal is enabled. The method is placed here to be easily accessible from various contexts. (Although it is a bit questionable if it isn't just too late to check the object after being "installed" intoMidPointPrincipal.) We assume that the object was recomputed.- Throws:
- SecurityViolationException
 
 
-