diff --git a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/API.java b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/API.java index 234e25166..dc7cc92b4 100644 --- a/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/API.java +++ b/api/org.integratedmodelling.klab.api/src/org/integratedmodelling/klab/api/API.java @@ -470,6 +470,10 @@ public static interface HUB { * Base URL path for custom properties related to a single user. */ public static final String USER_ID_CUSTOM_PROPERTIES = USER_BASE_ID + "/custom-properties"; + /** + * URL path for get SPA pages + */ + public static final String UI = "/ui/*"; public static interface PARAMETERS { /** diff --git a/klab.hub/src/main/java/org/integratedmodelling/klab/hub/security/HubRequestMatchers.java b/klab.hub/src/main/java/org/integratedmodelling/klab/hub/security/HubRequestMatchers.java index d8ed82ab8..9b5ffda3c 100644 --- a/klab.hub/src/main/java/org/integratedmodelling/klab/hub/security/HubRequestMatchers.java +++ b/klab.hub/src/main/java/org/integratedmodelling/klab/hub/security/HubRequestMatchers.java @@ -3,55 +3,23 @@ import org.integratedmodelling.klab.api.API; public final class HubRequestMatchers { - - private static final String[] authentication = new String[] { - API.HUB.AUTHENTICATE_ENGINE, - API.HUB.AUTHENTICATE_LEVER, - API.HUB.AUTHENTICATE_NODE, - API.HUB.AUTHENTICATE_USER, - }; - - private static final String[] usersPost = new String[] { - API.HUB.USER_BASE+".*" + API.HUB.PARAMETERS.USER_ACTIVATION + ".*", - API.HUB.USER_BASE+".*" + API.HUB.PARAMETERS.USER_LOST_PASSWORD + ".*", - API.HUB.USER_BASE+".*" + API.HUB.PARAMETERS.USER_SET_PASSWORD + ".*", - API.HUB.USER_BASE+".*" + API.HUB.PARAMETERS.USER_VERIFICATION + ".*", - API.HUB.USER_BASE+"$" - }; - - private static final String[] usersPut = new String[] { - API.HUB.USER_BASE+".*" + API.HUB.PARAMETERS.USER_SET_EMAIL + ".*", - API.HUB.USER_BASE+"$" - }; - - private static final String[] agreements = new String[] { - API.HUB.AGREEMENT_TEMPLATE_TYPE_LEVEL+"*" - }; - - private static final String[] usersGet = new String[] { - API.HUB.USER_BASE_NOAUTH+".*" + API.HUB.PARAMETERS.USER_GET + ".*", - API.HUB.USER_BASE+"$" - }; - - public static String[] getAuthentication() { - return authentication; - } - - public static String[] getUsersPost() { - return usersPost; - } - - public static String[] getAgreements() { - return agreements; - } - public static String[] getUsersGet() { - return usersGet; - } + private static final String[] authentication = new String[]{API.HUB.AUTHENTICATE_ENGINE, API.HUB.AUTHENTICATE_LEVER, + API.HUB.AUTHENTICATE_NODE}; + + private static final String[] agreements = new String[]{API.HUB.AGREEMENT_TEMPLATE_TYPE_LEVEL + "*"}; - public static String[] getUsersPut() { - return usersPut; - } + private static final String[] ui = new String[]{API.HUB.UI + "*"}; + + public static String[] getAuthentication() { + return authentication; + } - + public static String[] getAgreements() { + return agreements; + } + + public static String[] getUi() { + return ui; + } } diff --git a/klab.hub/src/main/java/org/integratedmodelling/klab/hub/security/WebSecurityConfiguration.java b/klab.hub/src/main/java/org/integratedmodelling/klab/hub/security/WebSecurityConfiguration.java index 04e34996c..c73d72c8b 100644 --- a/klab.hub/src/main/java/org/integratedmodelling/klab/hub/security/WebSecurityConfiguration.java +++ b/klab.hub/src/main/java/org/integratedmodelling/klab/hub/security/WebSecurityConfiguration.java @@ -11,9 +11,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; +import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.core.authority.mapping.SimpleAuthorityMapper; import org.springframework.security.crypto.password.LdapShaPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; @@ -53,27 +55,17 @@ public KeycloakConfigResolver KeycloakConfigResolver() { @Override protected void configure(HttpSecurity http) throws Exception { super.configure(http); - http.cors().and().csrf().disable().authorizeRequests().anyRequest().permitAll(); - + http.cors().and().csrf().disable().authorizeRequests().antMatchers(HttpMethod.GET, HubRequestMatchers.getAgreements()) + .permitAll().antMatchers(HttpMethod.POST, HubRequestMatchers.getAuthentication()).permitAll() + .antMatchers(HttpMethod.GET, HubRequestMatchers.getUi()).permitAll().anyRequest().authenticated().and() + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); } -// @Override -// protected void configure(HttpSecurity http) throws Exception { -// super.configure(http); -// http.cors().and().csrf().disable().authorizeRequests().antMatchers(HttpMethod.GET, HubRequestMatchers.getAgreements()) -// .permitAll().antMatchers(HttpMethod.POST, HubRequestMatchers.getAuthentication()).permitAll() -// .regexMatchers(HttpMethod.POST, HubRequestMatchers.getUsersPost()).permitAll() -// .regexMatchers(HttpMethod.GET, HubRequestMatchers.getUsersGet()).permitAll() -// .regexMatchers(HttpMethod.PUT, HubRequestMatchers.getUsersPut()).permitAll().anyRequest().authenticated().and() -// .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); -// } - @Bean CorsConfigurationSource corsConfigurationSource() { final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); final CorsConfiguration config = new CorsConfiguration(); config.setAllowCredentials(false); - config.setAllowedOrigins(Arrays.asList(corsHostsAllow)); config.setAllowedHeaders(Collections.singletonList("*")); config.addExposedHeader("Content-disposition"); diff --git a/klab.hub/src/main/resources/static/ui/index.html b/klab.hub/src/main/resources/static/ui/index.html index 6e27d1e5e..a505a0382 100644 --- a/klab.hub/src/main/resources/static/ui/index.html +++ b/klab.hub/src/main/resources/static/ui/index.html @@ -1 +1,2 @@ -
Context: ${e.properties.context_name}
\nApplications: ${e.properties.application}
\nObservations:
\nContext: ${e.properties.context_name}
\nApplications: ${e.properties.application}
\nObservations:
\nfirstname.lastname
pattern using 6 or more charactersARIES is an open system where all participants contribute and share knowledge for the common good. For this reason we ask that all accounts are traceable to real people and institutions. Please ensure that:
\nfirstname.lastname
pattern, with your real first and last name. All the accounts created from this page are individual. If you need an institutional account (for example to install a public engine) please contact us as this use, while still free for non-profit institutions, is covered by a separate EULA.We actively monitor the registration database and we regularly delete or disable accounts that do not match the above conditions. In addition, attempts to make for-profit use of ARIES products with a non-profit licensing terms will result in permanent exclusion from the registration system and potential legal prosecution according to the\n EULA.
\nBy clicking the acceptance button you agree that the personal data you provide will be processed by ASOCIACIÓN BC3 BASQUE CENTRE FOR CLIMATE CHANGE-KLIMA ALDAKETA IKERGAI with the purpose of\n managing your registration request and your access to the tool. You may exercise your rights on data protection at ARCrights@BC3research.org.\n
Additional information in this respect is available in the EULA
Insert your email address
",forgetPasswordInfo:"We'll send you a message to help you reset your password",forgetPasswordContent:'Please Contact Us if you require any assistance.',homeTitle:"Welcome",homeContent1:"\nThis site is the central authentication hub for all users of the k.LAB semantic web. We support both remote and local use of k.LAB\n through web-based clients and a modeler IDE.
\nTo access the remote clients you can choose one of the web applications available to your user by clicking the corresponding icon below.
\n ",homeContent2:'\nAll applications will use the concepts, data and models available in the k.LAB semantic web.
\nFor a more direct way of using k.LAB, including contributing new knowledge and exploring the knowledge base more in detail,\n you can install a local engine and the Integrated development environment (k.Modeler).
\nThese are available as a software download, managed through a small application named the k.LAB Control Center.\n Please download the Control Center software package from here.
\nTo run the engine you will require a certificate, which you can download (for non-profit use only)\n from the Profile menu (use the link Download certificate on the left menu).
\n\n ',downloadTitle:"",downloadContent:"",certificateTitle:"Certificate",certificateContentBeforeEULA:'\nBy downloading the certificate, you are accepting the END USER LICENSE AGREEMENT (EULA) for individual non-profit use.
\nIn addition and outside the EULA, the USER may obtain an open source license of the k.Lab SOFTWARE under the terms of the\n Affero General Public License 3.0\n or any higher version through the website integratedmodelling.org, which will allow you to exploit the k.Lab SOFTWARE under the terms of that license.
\n ',certificateContentAfterEULA:'\nClarification: the EULA regulates the access and use of the k.LAB system hosted in the BC3 INFRASTRUCTURE, including the semantic web of data, models powered by the SOFTWARE, and other data and resources made available to the USER through the BC3 INFRASTRUCTURE.\n See the complete terms of use here.
\n ',adminHomeTitle:"Administration",adminHomeContent:"\nThis page enables the management of k.LAB.
\nSelect an option from the left menu.
\n ",adminUsersTitle:"Users",adminGroupsTitle:"Groups",adminTasksTitle:"Tasks",adminAgreementTemplatesTitle:"Agreement Templates",adminNodesTitle:"Nodes",placeholderAgreementText:"Add agreement template's text",statsHomeTitle:"Statistics",statsHomeContent:"\nThis page is for extracting useful statistics from the k.labs server.
\nStart making queries from the left menu.
\n ",downloadCertificateChangeEmail:`As you've updated your email address, we advise you to consider the possibility of needing to download a new certificate to align with this change. This certificate will authenticate your device and is necessary to continue using the local engine.`},text:{changeEmail:"If you want to update the email address, please, set your actual password.",changeEmailUpdate:"Voila! You have successfully update the email address."}}}).call(this,s("4362"))},"9b2f":function(e,t,s){"use strict";s("29cb")},"9e5b":function(e,t,s){},"9e60":function(e,t,s){"use strict";s("3b09")},a6aa:function(e,t,s){},a90d:function(e,t,s){},b0a0:function(e,t,s){},b5be:function(e,t,s){},b96f:function(e,t,s){},baf1:function(e,t,s){"use strict";s("b0a0")},bb03:function(e,t,s){"use strict";s("c1d6")},bd3a:function(e,t,s){"use strict";s("a6aa")},c14d:function(e,t,s){e.exports=s.p+"img/marker-icon-success.eb603235.png"},c1d6:function(e,t,s){},cd23:function(e,t,s){"use strict";var a=function(){var e=this,t=e._self._c;return t("main",{staticClass:"kdc-container"},[e.menuItems.length>0?t("div",{staticClass:"kdc-menu-container fixed full-height"},[t("div",{staticClass:"kdc-menu"},e._l(e.menuItems,(function(s,a){return t("div",{key:a,staticClass:"kdc-menu-item"},[t("router-link",{staticClass:"kh-link",attrs:{to:{name:s.route},"active-class":"disabled",custom:""}},[e._v(e._s(s.label))])],1)})),0)]):e._e(),t("div",{staticClass:"kdc-content",class:[0===e.menuItems.length&&"kdc-no-menu"]},[e._t("default")],2)])},o=[],r={name:"KhubDefaultContainer",props:{menuItems:{type:Array,default:()=>[]}},data(){return{}},methods:{}},i=r,l=(s("4dcc"),s("2877")),n=Object(l["a"])(i,a,o,!1,null,null,null);t["a"]=n.exports},d782:function(e,t,s){"use strict";s("9e5b")},d856:function(e,t,s){},e9fb:function(e,t,s){},f439:function(e,t,s){},f594:function(e,t,s){"use strict";s("58e0")}}); \ No newline at end of file +(function(e){function t(t){for(var a,o,l=t[0],n=t[1],c=t[2],u=0,d=[];uContext: ${e.properties.context_name}
\nApplications: ${e.properties.application}
\nObservations:
\nContext: ${e.properties.context_name}
\nApplications: ${e.properties.application}
\nObservations:
\nfirstname.lastname
pattern using 6 or more charactersARIES is an open system where all participants contribute and share knowledge for the common good. For this reason we ask that all accounts are traceable to real people and institutions. Please ensure that:
\nfirstname.lastname
pattern, with your real first and last name. All the accounts created from this page are individual. If you need an institutional account (for example to install a public engine) please contact us as this use, while still free for non-profit institutions, is covered by a separate EULA.We actively monitor the registration database and we regularly delete or disable accounts that do not match the above conditions. In addition, attempts to make for-profit use of ARIES products with a non-profit licensing terms will result in permanent exclusion from the registration system and potential legal prosecution according to the\n EULA.
\nBy clicking the acceptance button you agree that the personal data you provide will be processed by ASOCIACIÓN BC3 BASQUE CENTRE FOR CLIMATE CHANGE-KLIMA ALDAKETA IKERGAI with the purpose of\n managing your registration request and your access to the tool. You may exercise your rights on data protection at ARCrights@BC3research.org.\n
Additional information in this respect is available in the EULA
Insert your email address
",forgetPasswordInfo:"We'll send you a message to help you reset your password",forgetPasswordContent:'Please Contact Us if you require any assistance.',homeTitle:"Welcome",homeContent1:"\nThis site is the central authentication hub for all users of the k.LAB semantic web. We support both remote and local use of k.LAB\n through web-based clients and a modeler IDE.
\nTo access the remote clients you can choose one of the web applications available to your user by clicking the corresponding icon below.
\n ",homeContent2:'\nAll applications will use the concepts, data and models available in the k.LAB semantic web.
\nFor a more direct way of using k.LAB, including contributing new knowledge and exploring the knowledge base more in detail,\n you can install a local engine and the Integrated development environment (k.Modeler).
\nThese are available as a software download, managed through a small application named the k.LAB Control Center.\n Please download the Control Center software package from here.
\nTo run the engine you will require a certificate, which you can download (for non-profit use only)\n from the Profile menu (use the link Download certificate on the left menu).
\n\n ',downloadTitle:"",downloadContent:"",certificateTitle:"Certificate",certificateContentBeforeEULA:'\nBy downloading the certificate, you are accepting the END USER LICENSE AGREEMENT (EULA) for individual non-profit use.
\nIn addition and outside the EULA, the USER may obtain an open source license of the k.Lab SOFTWARE under the terms of the\n Affero General Public License 3.0\n or any higher version through the website integratedmodelling.org, which will allow you to exploit the k.Lab SOFTWARE under the terms of that license.
\n ',certificateContentAfterEULA:'\nClarification: the EULA regulates the access and use of the k.LAB system hosted in the BC3 INFRASTRUCTURE, including the semantic web of data, models powered by the SOFTWARE, and other data and resources made available to the USER through the BC3 INFRASTRUCTURE.\n See the complete terms of use here.
\n ',adminHomeTitle:"Administration",adminHomeContent:"\nThis page enables the management of k.LAB.
\nSelect an option from the left menu.
\n ",adminUsersTitle:"Users",adminGroupsTitle:"Groups",adminTasksTitle:"Tasks",adminAgreementTemplatesTitle:"Agreement Templates",adminNodesTitle:"Nodes",placeholderAgreementText:"Add agreement template's text",statsHomeTitle:"Statistics",statsHomeContent:"\nThis page is for extracting useful statistics from the k.labs server.
\nStart making queries from the left menu.
\n ",downloadCertificateChangeEmail:`As you've updated your email address, we advise you to consider the possibility of needing to download a new certificate to align with this change. This certificate will authenticate your device and is necessary to continue using the local engine.`},text:{changeEmail:"If you want to update the email address, please, set your actual password.",changeEmailUpdate:"Voila! You have successfully update the email address."}}}).call(this,s("4362"))},"9b2f":function(e,t,s){"use strict";s("29cb")},"9e5b":function(e,t,s){},"9e60":function(e,t,s){"use strict";s("3b09")},a6aa:function(e,t,s){},a90d:function(e,t,s){},b0a0:function(e,t,s){},b5be:function(e,t,s){},b96f:function(e,t,s){},baf1:function(e,t,s){"use strict";s("b0a0")},bb03:function(e,t,s){"use strict";s("c1d6")},bd3a:function(e,t,s){"use strict";s("a6aa")},c14d:function(e,t,s){e.exports=s.p+"img/marker-icon-success.eb603235.png"},c1d6:function(e,t,s){},cd23:function(e,t,s){"use strict";var a=function(){var e=this,t=e._self._c;return t("main",{staticClass:"kdc-container"},[e.menuItems.length>0?t("div",{staticClass:"kdc-menu-container fixed full-height"},[t("div",{staticClass:"kdc-menu"},e._l(e.menuItems,(function(s,a){return t("div",{key:a,staticClass:"kdc-menu-item"},[t("router-link",{staticClass:"kh-link",attrs:{to:{name:s.route},"active-class":"disabled",custom:""}},[e._v(e._s(s.label))])],1)})),0)]):e._e(),t("div",{staticClass:"kdc-content",class:[0===e.menuItems.length&&"kdc-no-menu"]},[e._t("default")],2)])},o=[],r={name:"KhubDefaultContainer",props:{menuItems:{type:Array,default:()=>[]}},data(){return{}},methods:{}},i=r,l=(s("4dcc"),s("2877")),n=Object(l["a"])(i,a,o,!1,null,null,null);t["a"]=n.exports},d782:function(e,t,s){"use strict";s("9e5b")},d856:function(e,t,s){},e9fb:function(e,t,s){},f439:function(e,t,s){},f594:function(e,t,s){"use strict";s("58e0")}}); \ No newline at end of file