Class ServiceAccountApplicationUserImpl

java.lang.Object
com.atlassian.jira.user.ServiceAccountApplicationUserImpl
All Implemented Interfaces:
com.atlassian.crowd.embedded.api.service.ServiceAccount, WithId, WithKey, ApplicationUser, ServiceAccountApplicationUser, Serializable, Principal

public class ServiceAccountApplicationUserImpl extends Object implements ServiceAccountApplicationUser
See Also:
  • Constructor Details

    • ServiceAccountApplicationUserImpl

      public ServiceAccountApplicationUserImpl(Long id, String key, com.atlassian.crowd.embedded.api.service.ServiceAccount serviceAccount)
  • Method Details

    • withScopes

      public ServiceAccountApplicationUser withScopes(Set<com.atlassian.oauth2.scopes.api.Scope> allGrantedScopes)
    • devModeDecorator

      public ServiceAccountApplicationUser devModeDecorator()
      This decorator is used in dev mode to help discover places where directory id or directory properties are read from service account object. These methods shouldn't be called on service account object, as it is not a directory user. As a defensive measure, we do not throw exception in production code, but we do in dev mode.
    • getKey

      public String getKey()
      Description copied from interface: ApplicationUser
      Returns the key which distinguishes the ApplicationUser as unique. The same key is shared by all Users with the same username (ignoring case) across all user directories.
      Specified by:
      getKey in interface ApplicationUser
      Specified by:
      getKey in interface WithKey
      Returns:
      the key which distinguishes the ApplicationUser as unique
    • getUsername

      public String getUsername()
      Specified by:
      getUsername in interface ApplicationUser
      Returns:
      the username (login) of the user; must never be null.
      See Also:
    • getName

      public String getName()
      Description copied from interface: ApplicationUser
      Synonym for ApplicationUser.getUsername() and implementation of Principal.getName().
      Specified by:
      getName in interface ApplicationUser
      Specified by:
      getName in interface Principal
      Returns:
      the username (login) of the user; must never be null.
      See Also:
    • getDirectoryId

      public long getDirectoryId()
      Specified by:
      getDirectoryId in interface ApplicationUser
      Returns:
      the ID of the user directory that this user comes from.
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface ApplicationUser
      Specified by:
      isActive in interface com.atlassian.crowd.embedded.api.service.ServiceAccount
      Returns:
      true if this user is active.
    • getEmailAddress

      public String getEmailAddress()
      Specified by:
      getEmailAddress in interface ApplicationUser
      Returns:
      email address of the user.
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ApplicationUser
      Returns the display name of the user. This is sometimes referred to as "full name".
      Specified by:
      getDisplayName in interface ApplicationUser
      Specified by:
      getDisplayName in interface com.atlassian.crowd.embedded.api.service.ServiceAccount
      Returns:
      display name of the user, must never be null.
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface com.atlassian.crowd.embedded.api.service.ServiceAccount
    • getResourceRestrictions

      public Map<com.atlassian.crowd.embedded.api.service.ResourceType,Set<com.atlassian.crowd.embedded.api.service.Resource>> getResourceRestrictions()
      Specified by:
      getResourceRestrictions in interface com.atlassian.crowd.embedded.api.service.ServiceAccount
    • getDirectoryUser

      public com.atlassian.crowd.embedded.api.User getDirectoryUser()
      Specified by:
      getDirectoryUser in interface ApplicationUser
      Returns:
      the user as seen by the particular user directory that this User is defined in.
    • getId

      public Long getId()
      Specified by:
      getId in interface com.atlassian.crowd.embedded.api.service.ServiceAccount
      Specified by:
      getId in interface WithId
      Returns:
      the unique id of the entity.
    • equals

      public boolean equals(Object obj)
      Description copied from interface: ApplicationUser
      Implementations must ensure equality based on getKey().
      Specified by:
      equals in interface ApplicationUser
      Specified by:
      equals in interface Principal
      Overrides:
      equals in class Object
      Parameters:
      obj - object to compare to.
      Returns:
      true if and only if the key matches.
    • hashCode

      public int hashCode()
      Description copied from interface: ApplicationUser
      Implementations must produce a hashcode based on getKey().
      Specified by:
      hashCode in interface ApplicationUser
      Specified by:
      hashCode in interface Principal
      Overrides:
      hashCode in class Object
      Returns:
      hashcode.
    • toString

      public String toString()
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object
    • hasAnyScope

      public boolean hasAnyScope(String... anyScopes)
      Specified by:
      hasAnyScope in interface ServiceAccountApplicationUser
    • canAccessResource

      public boolean canAccessResource(ResourceRestrictionEntityType resourceType, String resourceId)
      Specified by:
      canAccessResource in interface ServiceAccountApplicationUser