forked from eclipse-basyx/basyx-java-server-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements authorization for ConnectedAasManager (eclipse-basyx#307)
* Implements authorization for ConnectedAasManager - Implements authorization for ConnectedAasRepository - Implements authorization for ConnectedAasService - Implements authorization for ConnectedSubmodelRepository - Implements authorization for ConnectedSubmodelService Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Refactors code Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Refactors BaSyx-realm.json Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Fixes compilation error in Registries Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Fixes issues in AAS Repo Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Refactors code Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Adds keycloak fix uri Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Refactors code Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Addressed review remarks and minor refactoring Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Refactors code Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Minor refactoring Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Addressed review remarks Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> * Minor refactoring Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]> --------- Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
- Loading branch information
Showing
86 changed files
with
8,124 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...va/org/eclipse/digitaltwin/basyx/aasenvironment/client/AuthorizedConnectedAasManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/******************************************************************************* | ||
* Copyright (C) 2024 the Eclipse BaSyx Authors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* SPDX-License-Identifier: MIT | ||
******************************************************************************/ | ||
|
||
package org.eclipse.digitaltwin.basyx.aasenvironment.client; | ||
|
||
import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.EndpointResolver; | ||
import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.DescriptorResolverManager; | ||
import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.authorization.AuthorizedAasDescriptorResolver; | ||
import org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers.authorization.AuthorizedSubmodelDescriptorResolver; | ||
import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetAdministrationShellDescriptor; | ||
import org.eclipse.digitaltwin.basyx.aasregistry.main.client.AuthorizedConnectedAasRegistry; | ||
import org.eclipse.digitaltwin.basyx.aasrepository.client.AuthorizedConnectedAasRepository; | ||
import org.eclipse.digitaltwin.basyx.aasservice.client.ConnectedAasService; | ||
import org.eclipse.digitaltwin.basyx.client.internal.authorization.TokenManager; | ||
import org.eclipse.digitaltwin.basyx.client.internal.resolver.DescriptorResolver; | ||
import org.eclipse.digitaltwin.basyx.submodelregistry.client.AuthorizedConnectedSubmodelRegistry; | ||
import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.SubmodelDescriptor; | ||
import org.eclipse.digitaltwin.basyx.submodelrepository.client.AuthorizedConnectedSubmodelRepository; | ||
import org.eclipse.digitaltwin.basyx.submodelservice.client.ConnectedSubmodelService; | ||
|
||
/** | ||
* Authorized client component for executing consolidated Repository and Registry requests | ||
* | ||
* @author danish | ||
* | ||
*/ | ||
public class AuthorizedConnectedAasManager extends ConnectedAasManager { | ||
|
||
public AuthorizedConnectedAasManager(AuthorizedConnectedAasRegistry authorizedAasRegistryApi, AuthorizedConnectedAasRepository authorizedAasRepository, AuthorizedConnectedSubmodelRegistry authorizedSubmodelRegistryApi, AuthorizedConnectedSubmodelRepository authorizedSubmodelRepository) { | ||
super(authorizedAasRegistryApi, authorizedAasRepository, authorizedSubmodelRegistryApi, authorizedSubmodelRepository, getAuthorizedResolver(authorizedAasRepository.getTokenManager(), authorizedSubmodelRepository.getTokenManager())); | ||
} | ||
|
||
private static DescriptorResolverManager getAuthorizedResolver(TokenManager authorizedAasRepoTokenManager, TokenManager authorizedSubmodelRepoTokenManager) { | ||
DescriptorResolver<AssetAdministrationShellDescriptor, ConnectedAasService> aasDescriptorResolver = new AuthorizedAasDescriptorResolver(new EndpointResolver(), authorizedAasRepoTokenManager); | ||
DescriptorResolver<SubmodelDescriptor, ConnectedSubmodelService> smDescriptorResolver = new AuthorizedSubmodelDescriptorResolver(new EndpointResolver(), authorizedSubmodelRepoTokenManager); | ||
|
||
return new DescriptorResolverManager(aasDescriptorResolver, smDescriptorResolver); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
.../eclipse/digitaltwin/basyx/aasenvironment/client/resolvers/DescriptorResolverManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/******************************************************************************* | ||
* Copyright (C) 2024 the Eclipse BaSyx Authors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining | ||
* a copy of this software and associated documentation files (the | ||
* "Software"), to deal in the Software without restriction, including | ||
* without limitation the rights to use, copy, modify, merge, publish, | ||
* distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to | ||
* the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* SPDX-License-Identifier: MIT | ||
******************************************************************************/ | ||
|
||
package org.eclipse.digitaltwin.basyx.aasenvironment.client.resolvers; | ||
|
||
import org.eclipse.digitaltwin.basyx.aasregistry.client.model.AssetAdministrationShellDescriptor; | ||
import org.eclipse.digitaltwin.basyx.aasservice.client.ConnectedAasService; | ||
import org.eclipse.digitaltwin.basyx.client.internal.resolver.DescriptorResolver; | ||
import org.eclipse.digitaltwin.basyx.submodelregistry.client.model.SubmodelDescriptor; | ||
import org.eclipse.digitaltwin.basyx.submodelservice.client.ConnectedSubmodelService; | ||
|
||
/** | ||
* A helper class for accumulating various {@link DescriptorResolver}s | ||
* | ||
* @author danish | ||
*/ | ||
public class DescriptorResolverManager { | ||
|
||
private DescriptorResolver<AssetAdministrationShellDescriptor, ConnectedAasService> aasDescriptorResolver; | ||
private DescriptorResolver<SubmodelDescriptor, ConnectedSubmodelService> submodelDescriptorResolver; | ||
|
||
public DescriptorResolverManager(DescriptorResolver<AssetAdministrationShellDescriptor, ConnectedAasService> aasDescriptorResolver, DescriptorResolver<SubmodelDescriptor, ConnectedSubmodelService> submodelDescriptorResolver) { | ||
super(); | ||
this.aasDescriptorResolver = aasDescriptorResolver; | ||
this.submodelDescriptorResolver = submodelDescriptorResolver; | ||
} | ||
|
||
public DescriptorResolver<AssetAdministrationShellDescriptor, ConnectedAasService> getAasDescriptorResolver() { | ||
return aasDescriptorResolver; | ||
} | ||
|
||
public DescriptorResolver<SubmodelDescriptor, ConnectedSubmodelService> getSubmodelDescriptorResolver() { | ||
return submodelDescriptorResolver; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.