Class SecurityContext
- java.lang.Object
-
- com.inductiveautomation.ignition.common.tags.model.SecurityContext
-
- All Implemented Interfaces:
java.io.Serializable
public abstract class SecurityContext extends java.lang.Object implements java.io.Serializable
Encapsulates contextual security information about the current user of the tag system- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.ThreadLocal<SecurityContext>
THREAD_LOCAL
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static SecurityContext
emptyContext()
boolean
equals(java.lang.Object o)
static SecurityContext
fromAuthenticatedUser(AuthenticatedUser user)
Create aSecurityContext
from the givenAuthenticatedUser
.static SecurityContext
fromRolesAndZones(com.google.common.collect.ImmutableCollection<java.lang.String> roles, com.google.common.collect.ImmutableCollection<java.lang.String> zones)
Create aSecurityContext
from the givenImmutableCollection
s of roles and zones.static SecurityContext
fromSecurityLevels(com.google.common.collect.ImmutableCollection<SecurityLevelConfig> securityLevels)
Create aSecurityContext
from the givenImmutableCollection
ofSecurityLevelConfig
s representing the children of the root public security levelabstract com.google.common.collect.ImmutableCollection<java.lang.String>
getRoles()
abstract com.google.common.collect.ImmutableCollection<SecurityLevelConfig>
getSecurityLevels()
abstract com.google.common.collect.ImmutableCollection<java.lang.String>
getSecurityZones()
int
hashCode()
abstract boolean
isSystem()
static SecurityContext
systemContext()
java.lang.String
toString()
-
-
-
Field Detail
-
THREAD_LOCAL
public static final java.lang.ThreadLocal<SecurityContext> THREAD_LOCAL
-
-
Method Detail
-
getRoles
public abstract com.google.common.collect.ImmutableCollection<java.lang.String> getRoles()
- Returns:
- the user's roles in this context
-
getSecurityZones
public abstract com.google.common.collect.ImmutableCollection<java.lang.String> getSecurityZones()
- Returns:
- the user's security zones in this context
-
getSecurityLevels
public abstract com.google.common.collect.ImmutableCollection<SecurityLevelConfig> getSecurityLevels()
- Returns:
- the user's security levels in this context
-
isSystem
public abstract boolean isSystem()
- Returns:
- If true, this indicates to the tag system that a tag write is originating from the gateway, and there is no relevant user info. Examples include gateway tag event scripts and tag writes from SFCs.
-
fromSecurityLevels
public static SecurityContext fromSecurityLevels(com.google.common.collect.ImmutableCollection<SecurityLevelConfig> securityLevels)
Create aSecurityContext
from the givenImmutableCollection
ofSecurityLevelConfig
s representing the children of the root public security level- Parameters:
securityLevels
- the security level tree node children of the root public security level- Returns:
- a new
SecurityContext
containing the given security level tree nodes
-
fromRolesAndZones
public static SecurityContext fromRolesAndZones(com.google.common.collect.ImmutableCollection<java.lang.String> roles, com.google.common.collect.ImmutableCollection<java.lang.String> zones)
Create aSecurityContext
from the givenImmutableCollection
s of roles and zones.- Parameters:
roles
- the roles assigned to the current userszones
- the security zones assigned to the current user- Returns:
- a new
SecurityContext
containing the given roles and zones
-
fromAuthenticatedUser
public static SecurityContext fromAuthenticatedUser(AuthenticatedUser user)
Create aSecurityContext
from the givenAuthenticatedUser
.- Parameters:
user
- the currently authenticated user- Returns:
- a new
SecurityContext
containing the given user's roles and zones
-
emptyContext
public static SecurityContext emptyContext()
- Returns:
- A SecurityContext without any security level, roles or zones set. Use when no authenticated user is present.
-
systemContext
public static SecurityContext systemContext()
- Returns:
- A SecurityContext without any security level, roles or zones set, but the isSystem flag is set to true. This indicates to the tag system that a tag write is originating from the gateway, and there is no relevant user info. Examples include gateway tag event scripts and tag writes from SFCs.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-