44import com .google .gson .GsonBuilder ;
55import io .permit .sdk .api .ApiClient ;
66import io .permit .sdk .api .ElementsApi ;
7+ import io .permit .sdk .api .PermitApiError ;
78import io .permit .sdk .enforcement .*;
89import io .permit .sdk .util .Context ;
910
@@ -104,10 +105,11 @@ public Permit(PermitConfig config) {
104105 * @param resource The resource object representing the resource.
105106 * @param context The context object representing the context in which the action is performed.
106107 * @return {@code true} if the user is authorized, {@code false} otherwise.
107- * @throws IOException if an error occurs while checking the authorization.
108+ * @throws PermitApiError if an error occurs while sending the authorization request to the PDP.
109+ * @throws IOException if could not read the content of the returned http response.
108110 */
109111 @ Override
110- public boolean check (User user , String action , Resource resource , Context context ) throws IOException {
112+ public boolean check (User user , String action , Resource resource , Context context ) throws IOException , PermitApiError {
111113 return this .enforcer .check (user , action , resource , context );
112114 }
113115
@@ -119,40 +121,51 @@ public boolean check(User user, String action, Resource resource, Context contex
119121 * @param action The action to be performed on the resource.
120122 * @param resource The resource object representing the resource.
121123 * @return {@code true} if the user is authorized, {@code false} otherwise.
122- * @throws IOException if an error occurs while checking the authorization.
124+ * @throws PermitApiError if an error occurs while sending the authorization request to the PDP.
125+ * @throws IOException if could not read the content of the returned http response.
123126 */
124127 @ Override
125- public boolean check (User user , String action , Resource resource ) throws IOException {
128+ public boolean check (User user , String action , Resource resource ) throws IOException , PermitApiError {
126129 return this .enforcer .check (user , action , resource );
127130 }
128131
129132 @ Override
130- public boolean checkUrl (User user , String httpMethod , String url , String tenant , Context context ) throws IOException {
133+ public boolean checkUrl (User user , String httpMethod , String url , String tenant , Context context ) throws IOException , PermitApiError {
131134 return this .enforcer .checkUrl (user , httpMethod , url , tenant , context );
132135 }
133136
134137 @ Override
135- public boolean checkUrl (User user , String httpMethod , String url , String tenant ) throws IOException {
138+ public boolean checkUrl (User user , String httpMethod , String url , String tenant ) throws IOException , PermitApiError {
136139 return this .enforcer .checkUrl (user , httpMethod , url , tenant );
137140 }
138141
139142 @ Override
140- public boolean [] bulkCheck (List <CheckQuery > checks ) throws IOException {
143+ public boolean [] bulkCheck (List <CheckQuery > checks ) throws IOException , PermitApiError {
141144 return this .enforcer .bulkCheck (checks );
142145 }
143146
144147 @ Override
145- public List <TenantDetails > checkInAllTenants (User user , String action , Resource resource , Context context ) throws IOException {
148+ public List <TenantDetails > checkInAllTenants (User user , String action , Resource resource , Context context ) throws IOException , PermitApiError {
146149 return this .enforcer .checkInAllTenants (user , action , resource , context );
147150 }
148151
149152 @ Override
150- public List <TenantDetails > checkInAllTenants (User user , String action , Resource resource ) throws IOException {
153+ public List <TenantDetails > checkInAllTenants (User user , String action , Resource resource ) throws IOException , PermitApiError {
151154 return this .enforcer .checkInAllTenants (user , action , resource );
152155 }
153156
154157 @ Override
155- public UserPermissions getUserPermissions (GetUserPermissionsQuery input ) throws IOException {
158+ public UserPermissions getUserPermissions (GetUserPermissionsQuery input ) throws IOException , PermitApiError {
156159 return this .enforcer .getUserPermissions (input );
157160 }
161+
162+ @ Override
163+ public List <TenantDetails > getUserTenants (User user , Context context ) throws IOException , PermitApiError {
164+ return this .enforcer .getUserTenants (user , context );
165+ }
166+
167+ @ Override
168+ public List <TenantDetails > getUserTenants (User user ) throws IOException , PermitApiError {
169+ return this .enforcer .getUserTenants (user );
170+ }
158171}
0 commit comments