Class SpiffeIdUtils
java.lang.Object
io.spiffe.spiffeid.SpiffeIdUtils
Utility class with methods to read SPIFFE IDs using different mechanisms.
-
Method Summary
Modifier and TypeMethodDescriptiongetSpiffeIdSetFromFile(Path spiffeIdsFile) Reads a file containing a list of SPIFFE IDs and parses them toSpiffeIdinstances.toSetOfSpiffeIds(String spiffeIds) Return the list of the SPIFFE IDs parsed from the String parameter, using the default separator (pipe character).toSetOfSpiffeIds(String spiffeIds, char separator) Parses a string representing a list of SPIFFE IDs and returns a list of instances ofSpiffeId.
-
Method Details
-
getSpiffeIdSetFromFile
Reads a file containing a list of SPIFFE IDs and parses them toSpiffeIdinstances.The file should have one SPIFFE ID per line.
- Parameters:
spiffeIdsFile- the path to the file containing a list of SPIFFE IDs- Returns:
- a List of
SpiffeIdparsed from the file provided - Throws:
IOException- if the given spiffeIdsFile cannot be readIllegalArgumentException- if any of the SPIFFE IDs in the file cannot be parsed
-
toSetOfSpiffeIds
Parses a string representing a list of SPIFFE IDs and returns a list of instances ofSpiffeId.- Parameters:
spiffeIds- a list of SPIFFE IDs represented in a stringseparator- used to separate the SPIFFE IDs in the string. Only the pipe character and the blank space are valid separators- Returns:
- a list of
SpiffeIdinstances. - Throws:
IllegalArgumentException- is the separator provided is not valid
-
toSetOfSpiffeIds
Return the list of the SPIFFE IDs parsed from the String parameter, using the default separator (pipe character).- Parameters:
spiffeIds- a String representing a list of SPIFFE IDs separated by the pipe character- Returns:
- a list of
SpiffeIdinstances - Throws:
IllegalArgumentException- is the string provided is blank
-