Package org.opencastproject.security.api
Class AccessControlParser
java.lang.Object
org.opencastproject.security.api.AccessControlParser
Marshals and unmarshals
AccessControlLists to/from XML.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringACE constant used in JSON formatted access control entriesstatic final StringACL constant used in JSON formatted access control entriesstatic final StringAction constant used in JSON formatted access control entriesstatic final StringAllow constant used in JSON formatted access control entriesstatic final StringEncoding expected from all inputsstatic final StringRole constant used in JSON formatted access control entries -
Method Summary
Modifier and TypeMethodDescriptionstatic AccessControlListparseAcl(InputStream in) Unmarshals an ACL from an xml input stream.static AccessControlListParses a string into an ACL.static AccessControlListparseAclSilent(String serializedForm) Same likeparseAcl(String)but throws runtime exceptions in case of an error.static StringtoJson(AccessControlList acl) static Stringstatic StringtoXml(AccessControlList acl) Serializes an AccessControlList to its XML form.
-
Field Details
-
ROLE
Role constant used in JSON formatted access control entries- See Also:
-
ACTION
Action constant used in JSON formatted access control entries- See Also:
-
ALLOW
Allow constant used in JSON formatted access control entries- See Also:
-
ACL
ACL constant used in JSON formatted access control entries- See Also:
-
ACE
ACE constant used in JSON formatted access control entries- See Also:
-
ENCODING
Encoding expected from all inputs- See Also:
-
-
Method Details
-
parseAcl
public static AccessControlList parseAcl(String serializedForm) throws IOException, AccessControlParsingException Parses a string into an ACL.- Parameters:
serializedForm- the string containing the xml or json formatted access control list.- Returns:
- the access control list
- Throws:
IOException- if the encoding is invalidAccessControlParsingException- if the format is invalid
-
parseAclSilent
Same likeparseAcl(String)but throws runtime exceptions in case of an error. -
parseAcl
public static AccessControlList parseAcl(InputStream in) throws IOException, AccessControlParsingException Unmarshals an ACL from an xml input stream.- Parameters:
in- the xml input stream- Returns:
- the acl
- Throws:
IOException- if there is a problem unmarshaling the streamAccessControlParsingException- if the format is invalid
-
toXml
Serializes an AccessControlList to its XML form.- Parameters:
acl- the access control list- Returns:
- the xml as a string
- Throws:
IOException- if there is a problem marshaling the xml
-
toJson
- Throws:
IOException
-
toJsonSilent
-