|
| 1 | +/* |
| 2 | + * Copyright 2023 Inrupt Inc. |
| 3 | + * |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | + * of this software and associated documentation files (the "Software"), to deal in |
| 6 | + * the Software without restriction, including without limitation the rights to use, |
| 7 | + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
| 8 | + * Software, and to permit persons to whom the Software is furnished to do so, |
| 9 | + * subject to the following conditions: |
| 10 | + * |
| 11 | + * The above copyright notice and this permission notice shall be included in |
| 12 | + * all copies or substantial portions of the Software. |
| 13 | + * |
| 14 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
| 15 | + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
| 16 | + * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 17 | + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 18 | + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 19 | + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 20 | + */ |
| 21 | +package com.inrupt.client.accessgrant; |
| 22 | + |
| 23 | +import java.net.URI; |
| 24 | +import java.time.Instant; |
| 25 | +import java.util.Optional; |
| 26 | +import java.util.Set; |
| 27 | + |
| 28 | +public interface AccessCredential { |
| 29 | + |
| 30 | + /** |
| 31 | + * Get the types of the access credential. |
| 32 | + * |
| 33 | + * @return the access credential types |
| 34 | + */ |
| 35 | + Set<String> getTypes(); |
| 36 | + |
| 37 | + /** |
| 38 | + * Get the access modes of the access credential. |
| 39 | + * |
| 40 | + * @return the access credential types |
| 41 | + */ |
| 42 | + Set<String> getModes(); |
| 43 | + |
| 44 | + /** |
| 45 | + * Get the revocation status of the access credential. |
| 46 | + * |
| 47 | + * @return the revocation status, if present |
| 48 | + */ |
| 49 | + Optional<Status> getStatus(); |
| 50 | + |
| 51 | + /** |
| 52 | + * Get the expiration time of the access credential. |
| 53 | + * |
| 54 | + * @return the expiration time |
| 55 | + */ |
| 56 | + Instant getExpiration(); |
| 57 | + |
| 58 | + /** |
| 59 | + * Get the issuer of the access credential. |
| 60 | + * |
| 61 | + * @return the issuer |
| 62 | + */ |
| 63 | + URI getIssuer(); |
| 64 | + |
| 65 | + /** |
| 66 | + * Get the identifier of the access credential. |
| 67 | + * |
| 68 | + * @return the identifier |
| 69 | + */ |
| 70 | + URI getIdentifier(); |
| 71 | + |
| 72 | + /** |
| 73 | + * Get the collection of purposes associated with the access credential. |
| 74 | + * |
| 75 | + * @return the purposes |
| 76 | + */ |
| 77 | + Set<String> getPurposes(); |
| 78 | + |
| 79 | + /** |
| 80 | + * Get the resources associated with the access credential. |
| 81 | + * |
| 82 | + * @return the associated resource identifiers |
| 83 | + */ |
| 84 | + Set<URI> getResources(); |
| 85 | + |
| 86 | + /** |
| 87 | + * Get the creator of this access credential. |
| 88 | + * |
| 89 | + * @return the creator |
| 90 | + */ |
| 91 | + URI getCreator(); |
| 92 | + |
| 93 | + /** |
| 94 | + * Get the recipient of this access credential. |
| 95 | + * |
| 96 | + * @return the recipient, if present |
| 97 | + */ |
| 98 | + Optional<URI> getRecipient(); |
| 99 | + |
| 100 | + /** |
| 101 | + * Serialize this access credential as a String. |
| 102 | + * |
| 103 | + * @return a serialized form of the credential |
| 104 | + */ |
| 105 | + String serialize(); |
| 106 | +} |
0 commit comments