Skip to content

Commit

Permalink
Ability to extend authentication imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
jadelkhoury committed Jun 14, 2023
1 parent 62a4393 commit 8796e5a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 36 deletions.
Expand Up @@ -26,30 +26,7 @@
[import org::eclipse::lyo::oslc4j::codegenerator::services::serviceProviderCatalogServices/]
[import org::eclipse::lyo::oslc4j::codegenerator::services::osgiServices/]

[template public additionalResourceClasses(anAdaptorInterface : AdaptorInterface) post (trim())]
[/template]

[template public generateAdaptorApplication(anAdaptorInterface : AdaptorInterface)]
[file (javaClassFullFileNameForAdaptorApplication(anAdaptorInterface), false, 'UTF-8')]
// [protected ('Copyright')]
/*
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Simple
*
* This file is generated by Lyo Designer (https://www.eclipse.org/lyo/)
*/
// [/protected]

package [javaClassPackageNameForAdaptorApplication(anAdaptorInterface) /];

[template public generateImports(anAdaptorInterface : AdaptorInterface)]
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -111,6 +88,33 @@ import org.eclipse.lyo.oslc4j.trs.server.service.TrackedResourceSetService;

// [protected ('imports')]
// [/protected]
[/template]

[template public additionalResourceClasses(anAdaptorInterface : AdaptorInterface) post (trim())]
[/template]

[template public generateAdaptorApplication(anAdaptorInterface : AdaptorInterface)]
[file (javaClassFullFileNameForAdaptorApplication(anAdaptorInterface), false, 'UTF-8')]
// [protected ('Copyright')]
/*
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Simple
*
* This file is generated by Lyo Designer (https://www.eclipse.org/lyo/)
*/
// [/protected]

package [javaClassPackageNameForAdaptorApplication(anAdaptorInterface) /];

[generateImports(anAdaptorInterface)/]

// [protected ('pre_class_code')]
// [/protected]
Expand Down
Expand Up @@ -45,26 +45,38 @@ JAXRSConcatURISegments(anAdaptorInterface.getApplicationBaseUrl(), anAdaptorInte
JAXRSConcatURISegments(anAdaptorInterface.configuration.applicationContextPath, anAdaptorInterface.getServletPath())
/]

[query public authenticationOauthRealm(anAdaptorInterface : AdaptorInterface) : String =
anAdaptorInterface.configuration.authenticationConfiguration.oauthRealm
/]

[query public authenticationApplicationName(anAdaptorInterface : AdaptorInterface) : String =
anAdaptorInterface.configuration.authenticationConfiguration.applicationName
/]

[query public authenticationEnabled(anAdaptorInterface : AdaptorInterface) : Boolean =
[query public getAuthenticationConfiguration(anAdaptorInterface : AdaptorInterface) : AuthenticationConfiguration =
(if (anAdaptorInterface.configuration.oclIsUndefined()) then
false
null
else
(if anAdaptorInterface.configuration.authenticationConfiguration.oclIsUndefined() then
false
null
else
true
anAdaptorInterface.configuration.authenticationConfiguration
endif)
endif)
/]

[query public authenticationEnabled(anAdaptorInterface : AdaptorInterface) : Boolean =
not anAdaptorInterface.getAuthenticationConfiguration().oclIsUndefined()
/]

[query public authenticationOauthRealm(anAdaptorInterface : AdaptorInterface) : String =
(if anAdaptorInterface.authenticationEnabled() then
anAdaptorInterface.getAuthenticationConfiguration().oauthRealm
else
null
endif)
/]

[query public authenticationApplicationName(anAdaptorInterface : AdaptorInterface) : String =
(if anAdaptorInterface.authenticationEnabled() then
anAdaptorInterface.getAuthenticationConfiguration().applicationName
else
null
endif)
/]

[query public swaggerDocumentationEnabled(anAdaptorInterface : AdaptorInterface) : Boolean =
(if anAdaptorInterface.swaggerDocumentation.oclIsUndefined() then
false
Expand Down

0 comments on commit 8796e5a

Please sign in to comment.