Class ServerPrincipal
- java.lang.Object
-
- jetbrains.buildServer.serverSide.auth.ServerPrincipal
-
- All Implemented Interfaces:
Principal
- Direct Known Subclasses:
BuildPrincipal
,GuestPrincipal
,PresignedTokenPrincipal
,SuperUserPrincipal
public class ServerPrincipal extends Object implements Principal
Represents authenticated user.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ServerPrincipal.AuthenticationResult
-
Constructor Summary
Constructors Constructor Description ServerPrincipal(String realm, String name)
ServerPrincipal(String realm, String name, PermissionsHolder permissionsHolder)
ServerPrincipal(String realm, String name, AuthPropertyKey usernamePropertyKey, boolean creatingNewUserAllowed, Map<PropertyKey,String> newUserProperties)
ServerPrincipal(String realm, String name, AuthPropertyKey usernamePropertyKey, boolean creatingNewUserAllowed, Map<PropertyKey,String> newUserProperties, PermissionsHolder permissionsHolder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
Map<PropertyKey,String>
getNewUserProperties()
PermissionsHolder
getPermissionsRestrictor()
String
getRealm()
AuthPropertyKey
getUsernamePropertyKey()
boolean
isCreatingNewUserAllowed()
-
-
-
Constructor Detail
-
ServerPrincipal
public ServerPrincipal(@Nullable String realm, @NotNull String name)
- Parameters:
realm
- - obsolete, should generally be nullname
- TeamCity's username
-
ServerPrincipal
public ServerPrincipal(@Nullable String realm, @NotNull String name, @Nullable PermissionsHolder permissionsHolder)
-
ServerPrincipal
public ServerPrincipal(@Nullable String realm, @NotNull String name, @Nullable AuthPropertyKey usernamePropertyKey, boolean creatingNewUserAllowed, @NotNull Map<PropertyKey,String> newUserProperties)
- Parameters:
realm
- - obsolete, should generally be nullname
- either TeamCity's username (if usernamePropertyKey is null) or custom username that is held in user usernamePropertyKey propertyusernamePropertyKey
- the name of the user property to look for the custom username specified in the name parametercreatingNewUserAllowed
-true
to allow creating the user if he/she does not exist yet,false
otherwisenewUserProperties
- Adds user properties to the user in case he/she is created during login. Has no effect for already existing users. Also has no effect ifcreatingNewUserAllowed
is set tofalse
.- Since:
- 8.0
-
ServerPrincipal
public ServerPrincipal(@Nullable String realm, @NotNull String name, @Nullable AuthPropertyKey usernamePropertyKey, boolean creatingNewUserAllowed, @NotNull Map<PropertyKey,String> newUserProperties, @Nullable PermissionsHolder permissionsHolder)
- Parameters:
realm
- - obsolete, should generally be nullname
- either TeamCity's username (if usernamePropertyKey is null) or custom username that is held in user usernamePropertyKey propertyusernamePropertyKey
- the name of the user property to look for the custom username specified in the name parametercreatingNewUserAllowed
-true
to allow creating the user if he/she does not exist yet,false
otherwisenewUserProperties
- Adds user properties to the user in case he/she is created during login. Has no effect for already existing users. Also has no effect ifcreatingNewUserAllowed
is set tofalse
.permissionsRestrictor
- Won't have any effect if null. If not null the the user created from this Principal will be restricted: remember me won't be used; permissions of the user will be restricted with this instance;- Since:
- 2020.1.1
-
-
Method Detail
-
getPermissionsRestrictor
@Nullable public PermissionsHolder getPermissionsRestrictor()
-
getRealm
@Nullable public String getRealm()
-
getUsernamePropertyKey
@Nullable public AuthPropertyKey getUsernamePropertyKey()
- Returns:
- user property key to look for the specified username in
- Since:
- 8.0
- See Also:
UserModel.findUserByUsername(String, jetbrains.buildServer.users.AuthPropertyKey)
-
isCreatingNewUserAllowed
public boolean isCreatingNewUserAllowed()
- Returns:
- true, iff TeamCity is allowed to create the specified user in case he/she does not exist yet.
- Since:
- 8.0
- See Also:
getNewUserProperties()
-
getNewUserProperties
@NotNull public Map<PropertyKey,String> getNewUserProperties()
- Returns:
- user properties to add to user in case he/she was created during login
- Since:
- 8.0
- See Also:
isCreatingNewUserAllowed()
-
-