Class BasicSecurityPolicy
java.lang.Object
net.solarnetwork.central.security.BasicSecurityPolicy
- All Implemented Interfaces:
Serializable,SecurityPolicy
Basic implementation of
SecurityPolicy.- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface net.solarnetwork.central.security.SecurityPolicy
INVERTED_PATH_MATCH_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionBasicSecurityPolicy(Set<Long> nodeIds, Set<String> sourceIds, Set<net.solarnetwork.domain.datum.Aggregation> aggregations, net.solarnetwork.domain.datum.Aggregation minAggregation, Set<LocationPrecision> locationPrecisions, LocationPrecision minLocationPrecision, Set<String> nodeMetadataPaths, Set<String> userMetadataPaths) Constructor.BasicSecurityPolicy(Set<Long> nodeIds, Set<String> sourceIds, Set<net.solarnetwork.domain.datum.Aggregation> aggregations, net.solarnetwork.domain.datum.Aggregation minAggregation, Set<LocationPrecision> locationPrecisions, LocationPrecision minLocationPrecision, Set<String> nodeMetadataPaths, Set<String> userMetadataPaths, Instant notAfter, Boolean refreshAllowed) Constructor.BasicSecurityPolicy(Set<Long> nodeIds, Set<String> sourceIds, Set<net.solarnetwork.domain.datum.Aggregation> aggregations, net.solarnetwork.domain.datum.Aggregation minAggregation, Set<LocationPrecision> locationPrecisions, LocationPrecision minLocationPrecision, Set<String> nodeMetadataPaths, Set<String> userMetadataPaths, Set<String> apiPaths, Instant notAfter, Boolean refreshAllowed) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic BasicSecurityPolicy.Builderbuilder()Get a new builder instance.booleanSet<net.solarnetwork.domain.datum.Aggregation> Get a set of aggregations this policy applies to.Get a set of API paths this policy allows.Get a location precision this policy applies to.net.solarnetwork.domain.datum.AggregationGet a minimum aggregation level this policy applies to.Get a minimum location precision this policy applies to.Get a set of node IDs this policy applies to.Get a set of node metadata paths this policy applies to.Get a date after which a token is no longer valid.Flag indicating if the token can be refreshed.Get a set of source IDs this policy applies to.Get a set of user metadata paths this policy applies to.inthashCode()booleanTest if the policy is valid at a specific date.toString()
-
Constructor Details
-
BasicSecurityPolicy
public BasicSecurityPolicy(Set<Long> nodeIds, Set<String> sourceIds, Set<net.solarnetwork.domain.datum.Aggregation> aggregations, net.solarnetwork.domain.datum.Aggregation minAggregation, Set<LocationPrecision> locationPrecisions, LocationPrecision minLocationPrecision, Set<String> nodeMetadataPaths, Set<String> userMetadataPaths) Constructor.The
notAfterproperty will be set to null (for no expiration date) andrefreshableto false.- Parameters:
nodeIds- The node IDs to restrict to, or null for no restriction.sourceIds- The source ID to restrict to, or null for no restriction.aggregations- The aggregations to restrict to, or null for no restriction.minAggregation- If specified, a minimum aggregation level that is allowed.locationPrecisions- The location precisions to restrict to, or null for no restriction.minLocationPrecision- If specified, a minimum location precision that is allowed.nodeMetadataPaths- TheSolarNodeMetadatapaths to restrict to, or null for no restriction.userMetadataPaths- TheUserNodeMetadatapaths to restrict to, or null for no restriction.
-
BasicSecurityPolicy
public BasicSecurityPolicy(Set<Long> nodeIds, Set<String> sourceIds, Set<net.solarnetwork.domain.datum.Aggregation> aggregations, net.solarnetwork.domain.datum.Aggregation minAggregation, Set<LocationPrecision> locationPrecisions, LocationPrecision minLocationPrecision, Set<String> nodeMetadataPaths, Set<String> userMetadataPaths, Instant notAfter, Boolean refreshAllowed) Constructor.- Parameters:
nodeIds- The node IDs to restrict to, or null for no restriction.sourceIds- The source ID to restrict to, or null for no restriction.aggregations- The aggregations to restrict to, or null for no restriction.minAggregation- If specified, a minimum aggregation level that is allowed.locationPrecisions- The location precisions to restrict to, or null for no restriction.minLocationPrecision- If specified, a minimum location precision that is allowed.nodeMetadataPaths- TheSolarNodeMetadatapaths to restrict to, or null for no restriction.userMetadataPaths- TheUserNodeMetadatapaths to restrict to, or null for no restriction.notAfter- A date after which the token is no longer valid, or null for no expiration.refreshAllowed- true if the token can be refreshed- Since:
- 2.0
-
BasicSecurityPolicy
public BasicSecurityPolicy(Set<Long> nodeIds, Set<String> sourceIds, Set<net.solarnetwork.domain.datum.Aggregation> aggregations, net.solarnetwork.domain.datum.Aggregation minAggregation, Set<LocationPrecision> locationPrecisions, LocationPrecision minLocationPrecision, Set<String> nodeMetadataPaths, Set<String> userMetadataPaths, Set<String> apiPaths, Instant notAfter, Boolean refreshAllowed) Constructor.- Parameters:
nodeIds- The node IDs to restrict to, or null for no restriction.sourceIds- The source ID to restrict to, or null for no restriction.aggregations- The aggregations to restrict to, or null for no restriction.minAggregation- If specified, a minimum aggregation level that is allowed.locationPrecisions- The location precisions to restrict to, or null for no restriction.minLocationPrecision- If specified, a minimum location precision that is allowed.nodeMetadataPaths- TheSolarNodeMetadatapaths to restrict to, or null for no restriction.userMetadataPaths- TheUserNodeMetadatapaths to restrict to, or null for no restriction.apiPaths- The API paths to restrict to, or null for no restriction.notAfter- A date after which the token is no longer valid, or null for no expiration.refreshAllowed- true if the token can be refreshed- Since:
- 2.0
-
-
Method Details
-
builder
Get a new builder instance.- Returns:
- the new builder
- Since:
- 2.0
-
getNodeIds
Description copied from interface:SecurityPolicyGet a set of node IDs this policy applies to.- Specified by:
getNodeIdsin interfaceSecurityPolicy- Returns:
- set of node IDs, or
null
-
getSourceIds
Description copied from interface:SecurityPolicyGet a set of source IDs this policy applies to.- Specified by:
getSourceIdsin interfaceSecurityPolicy- Returns:
- set of source IDs
-
getAggregations
Description copied from interface:SecurityPolicyGet a set of aggregations this policy applies to.- Specified by:
getAggregationsin interfaceSecurityPolicy- Returns:
- set of aggregations
-
getLocationPrecisions
Description copied from interface:SecurityPolicyGet a location precision this policy applies to.- Specified by:
getLocationPrecisionsin interfaceSecurityPolicy- Returns:
- set of precisions
-
getMinAggregation
public net.solarnetwork.domain.datum.Aggregation getMinAggregation()Description copied from interface:SecurityPolicyGet a minimum aggregation level this policy applies to.- Specified by:
getMinAggregationin interfaceSecurityPolicy- Returns:
- The minimum aggregation level.
-
getMinLocationPrecision
Description copied from interface:SecurityPolicyGet a minimum location precision this policy applies to.- Specified by:
getMinLocationPrecisionin interfaceSecurityPolicy- Returns:
- The minimum location precision.
-
getNodeMetadataPaths
Description copied from interface:SecurityPolicyGet a set of node metadata paths this policy applies to.- Specified by:
getNodeMetadataPathsin interfaceSecurityPolicy- Returns:
- set of node metadata paths
-
getUserMetadataPaths
Description copied from interface:SecurityPolicyGet a set of user metadata paths this policy applies to.- Specified by:
getUserMetadataPathsin interfaceSecurityPolicy- Returns:
- set of user metadata paths
-
getApiPaths
Description copied from interface:SecurityPolicyGet a set of API paths this policy allows.API paths are URL paths that support Ant-style patterns. If a path starts with ! then the match is inverted, so that any path not matching the pattern is allowed. Note that if any paths are defined here, then only paths that match some pattern are allowed. Or put another way, paths are denied unless some pattern matches.
- Specified by:
getApiPathsin interfaceSecurityPolicy- Returns:
- set of allowed API paths, or null or empty set if all paths are allowed
-
getNotAfter
Description copied from interface:SecurityPolicyGet a date after which a token is no longer valid.- Specified by:
getNotAfterin interfaceSecurityPolicy- Returns:
- the expire date, or null for no expiration
-
isValidAt
Description copied from interface:SecurityPolicyTest if the policy is valid at a specific date.- Specified by:
isValidAtin interfaceSecurityPolicy- Parameters:
timestamp- the time to test- Returns:
- false if
notAfteris set on the policy andtimestampis after that
-
getRefreshAllowed
Description copied from interface:SecurityPolicyFlag indicating if the token can be refreshed.- Specified by:
getRefreshAllowedin interfaceSecurityPolicy- Returns:
- true if a token can be refreshed, false otherwise
-
hashCode
public int hashCode() -
equals
-
toString
-