public class JsonPolicyReader
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
JsonPolicyReader.NamedAction
An auxiliary class to help instantiate the action object.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
PRINCIPAL_SCHEMA_SERVICE |
private static java.lang.String |
PRINCIPAL_SCHEMA_USER |
private static java.lang.String |
PRINICIPAL_SCHEMA_FEDERATED |
Constructor and Description |
---|
JsonPolicyReader() |
Modifier and Type | Method and Description |
---|---|
private java.util.List<Action> |
actionsOf(com.fasterxml.jackson.databind.JsonNode actionNodes)
Generates a list of actions from the Action Json Node.
|
private java.util.List<Condition> |
conditionsOf(com.fasterxml.jackson.databind.JsonNode conditionNodes)
Generates a list of condition from the Json node.
|
private void |
convertConditionRecord(java.util.List<Condition> conditions,
java.lang.String conditionType,
com.fasterxml.jackson.databind.JsonNode conditionNode)
Generates a condition instance for each condition type under the
Condition Json node.
|
Policy |
createPolicyFromJsonString(java.lang.String jsonString)
Converts the specified JSON string to an AWS policy object.
|
private Principal |
createPrincipal(java.lang.String schema,
com.fasterxml.jackson.databind.JsonNode principalNode)
Creates a new principal instance for the given schema and the Json node.
|
private boolean |
isNotNull(java.lang.Object object)
Checks if the given object is not null.
|
private java.util.List<Principal> |
principalOf(com.fasterxml.jackson.databind.JsonNode principalNodes)
Generates a list of principals from the Principal Json Node
|
private java.util.List<Resource> |
resourcesOf(com.fasterxml.jackson.databind.JsonNode resourceNodes)
Generates a list of resources from the Resource Json Node.
|
private Statement |
statementOf(com.fasterxml.jackson.databind.JsonNode jStatement)
Creates a
Statement |
private static final java.lang.String PRINCIPAL_SCHEMA_USER
private static final java.lang.String PRINCIPAL_SCHEMA_SERVICE
private static final java.lang.String PRINICIPAL_SCHEMA_FEDERATED
public Policy createPolicyFromJsonString(java.lang.String jsonString)
jsonString
- the specified JSON string representation of this AWS access
control policy.java.lang.IllegalArgumentException
- If the specified JSON string is null or invalid and cannot be
converted to an AWS policy object.private Statement statementOf(com.fasterxml.jackson.databind.JsonNode jStatement)
Statement instance from the statement node.
A statement consists of an Effect, id (optional), principal, action, resource,
and conditions.
principal is the AWS account that is making a request to access or modify one of your AWS resources.
action is the way in which your AWS resource is being accessed or modified, such as sending a message to an Amazon SQS queue, or storing an object in an Amazon S3 bucket.
resource is the AWS entity that the principal wants to access, such as an Amazon SQS queue, or an object stored in Amazon S3.
conditions are the optional constraints that specify when to allow or deny access for the principal to access your resource. Many expressive conditions are available, some specific to each service. For example, you can use date conditions to allow access to your resources only after or before a specific time.
jStatement
- JsonNode representing the statement.private java.util.List<Action> actionsOf(com.fasterxml.jackson.databind.JsonNode actionNodes)
actionNodes
- the action Json node to be parsed.private java.util.List<Resource> resourcesOf(com.fasterxml.jackson.databind.JsonNode resourceNodes)
resourceNodes
- the resource Json node to be parsed.private java.util.List<Principal> principalOf(com.fasterxml.jackson.databind.JsonNode principalNodes)
principalNodes
- the principal Json to be parsedprivate Principal createPrincipal(java.lang.String schema, com.fasterxml.jackson.databind.JsonNode principalNode)
schema
- the schema for the principal instance being created.principalNode
- the node indicating the AWS account that is making the
request.private java.util.List<Condition> conditionsOf(com.fasterxml.jackson.databind.JsonNode conditionNodes)
conditionNodes
- the condition Json node to be parsed.private void convertConditionRecord(java.util.List<Condition> conditions, java.lang.String conditionType, com.fasterxml.jackson.databind.JsonNode conditionNode)
conditions
- the complete list of conditionsconditionType
- the condition type for the condition being created.conditionNode
- each condition node to be parsed.private boolean isNotNull(java.lang.Object object)
object
- the object compared to null.