client-shared
¶
client-shared
is some of the shared operations and configurations between
the client
and client-direct
components.
See options for customisable User Authentication and Authorisation.
See options for customisable user registration.
Initial installation¶
Download the project source and go to this component’s root directory (i.e. client-shared) and follow the steps below.
- Either …
- … or …
- [ T ] Copy sample.pom.xml to
pom.xml
- [ T ] Copy src/main/resources/META-INF/data/spring-security/local/sample.users.sql to
src/main/resources/META-INF/data/spring-security/local/users.sql
- [ T ] Copy src/main/resources/META-INF/resources/resources/css/site/sample.client-shared-site.css to
src/main/resources/META-INF/resources/resources/css/site/client-shared-site.css
- [ T ] Copy src/main/resources/META-INF/resources/WEB-INF/spring/ctx/config/sample.appCtx.features.xml to
src/main/resources/META-INF/resources/WEB-INF/spring/ctx/config/appCtx.features.xml
- [ T ] Copy src/main/resources/META-INF/resources/WEB-INF/tiles/layout/common/sample.logo.jsp to
src/main/resources/META-INF/resources/WEB-INF/tiles/layout/common/logo.jsp
- [ T ] Copy src/main/resources/META-INF/resources/WEB-INF/tiles/layout/common/sample.logout.jsp to
src/main/resources/META-INF/resources/WEB-INF/tiles/layout/common/logout.jsp
- [ T ] Copy src/main/resources/META-INF/resources/WEB-INF/tiles/layout/contact/sample.contact.jsp to
src/main/resources/META-INF/resources/WEB-INF/tiles/layout/contact/contact.jsp
- [ S ] Copy src/main/resources/WEB-INF/spring/authn/sample.appCtx.bespoke.xml to
src/main/resources/WEB-INF/spring/authn/appCtx.bespoke.xml
- [ S ] Copy src/main/resources/WEB-INF/spring/authn/sample.appCtx.sitePreauthFilter.xml to
src/main/resources/WEB-INF/spring/authn/appCtx.sitePreauthFilter.xml
- [ S ] Copy src/main/resources/WEB-INF/spring/sample.root-context.site.xml to
src/main/resources/WEB-INF/spring/root-context.site.xml
- [ T ] Copy src/properties/sample.cs-filter.properties to
src/properties/cs-filter.properties
- … finally
- Edit each of the copied files according to your desired configuration.
Configuration¶
pom.xml
¶
It may necessary in some circumstances, e.g. if there is site-specific access
control code being overlayed into the client
src/main/java
directory, or if using a MySQL driver, to adapt the pom.xml
file for
Maven-building the component.
src/main/resources/META-INF/data/spring-security/local/users.sql
¶
Adjust this according to your expected usage requirements :
- If you are using a local
client
- and/orclient-direct
-specific “prepopulated user authentication” mechanism for authentication and authorisation, this file is required.
Please also check the following Note.- If you are using a “bespoke user authentication” mechanism then this file is not required.
Note
If there is a new registration request the requesting user’s details
are not automatically written to the user database.
New users must be manually added to this users.sql
file and the
system restarted – for this reason it is better to create a number of
unissued usernames and passwords (commensurate with the total anticipated
usage) and then distribute them to new registrations as they arrive.
src/main/resources/META-INF/resources/resources/css/site/client-shared-site.css
¶
Generally no change necessary.
src/main/resources/META-INF/resources/WEB-INF/spring/ctx/config/appCtx.features.xml
¶
Adjust the visibility of certain portal features (e.g. entering ion channel spread values) to certain groups of users as determined by their “Role”.
See also
src/main/resources/META-INF/resources/WEB-INF/spring/ctx/appCtx.multipart.xml
¶
Generally no change necessary.
filterMultipartResolver
controls the maximum file size which can be uploaded.fileStorageCellML
andfileStoragePK
control the enforcement ofUTF-8
encoding file content.
See also
src/properties/cs-filter.properties
for assignment of multipart.fileupload.maxinmemorysize
and
multipart.fileupload.maxuploadsize
.
See also
MySQL’s max_allowed_packet,
which may need to be set to perhaps 40Mb or more, depending on PK file data content
size, and,
uk.ac.ox.cs.compbio.client_shared.entity.PortalFile#MAX_SIZE
src/main/resources/META-INF/resources/WEB-INF/tiles/layout/common/logo.jsp
¶
Adjust the HTML according to the desired appearance of the top-left of the page which is usually where the logo is found.
The example logo.jsp
content below places the fictional company logo in
the top left of the display by referencing the corresponding logo image placed
in the src/main/resources/META-INF/resources/resources/img/site/
directory
prior to build.
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<img src="<c:url value="/resources/img/site/company_logo.png" />" alt="Company logo" />
src/main/resources/META-INF/resources/WEB-INF/tiles/layout/common/logout.jsp
¶
Adjust according to your logging out mechanism.
src/main/resources/META-INF/resources/WEB-INF/tiles/layout/contact/contact.jsp
¶
Adjust the HTML to provide contact details of the relevant people.
An example contact.jsp
content may be as follows.
Click the following links to email support :
<p>
Scientific support : <a href="mailto:ap-portal-scientific@company.com">click here</a>
</p>
<p>
Technical support : <a href="mailto:ap-portal-technical@company.com">click here</a>
</p>
src/main/resources/WEB-INF/spring/authn/appCtx.bespoke.xml
¶
Generally no change necessary.
src/main/resources/WEB-INF/spring/authn/appCtx.sitePreauthFilter.xml
¶
Needs to be adjusted if adopting the “bespoke user authentication” mechanism.
src/main/resources/WEB-INF/spring/root-context.site.xml
¶
Generally no change necessary.
src/properties/cs-filter.properties
¶
See also
For the following email-related properties take a look at the JavaMail API documentation
mail.smtp.host=
New registration email mail server SMTP host, e.g. ‘smtp.company.com’.
mail.smtp.port=
New registration email mail server port, e.g. ‘25’ or ‘587’.
Warning
Always assign an integer value here, even if no SMTP service is available.
mail.smtp.username=
New registration email mail server user name.
mail.smtp.password=
New registration email mail server user’s password.
mail.regn.from=
New registration email “From” email address, e.g. ‘noreply-portal-registrations@company.com’.
mail.regn.to=
New registration email “To” email address, e.g. ‘portal-registrations@company.com’.
mail.regn.subject=
New regisration email subject title, e.g. ‘New registration’.
mail.transport.protocol=
New registration email mail transport protocol (see appCtx.mail.xml
), e.g. ‘smtp’.
mail.smtp.auth=
New registration email SMTP authentication required (see appCtx.mail.xml
), e.g.
(true|false)
.
mail.smtp.connectiontimeout=
New registration email SMTP connection timeout (i.e. time to respond once connected) in
milliseconds (see appCtx.mail.xml
), e.g. ‘2000’.
mail.smtp.timeout=
New registration email SMTP timeout (to establish a connection) in milliseconds (see
appCtx.mail.xml
), e.g. ‘2000’.
mail.smtp.starttls.enable=
New registration email SMTP connection instruction to start TLS (see appCtx.mail.xml
),
e.g. (true|false)
.
mail.smtp.ssl.enable=
New registration email SMTP connection instruction to start TLS (see appCtx.mail.xml
),
e.g. (true|false)
.
mail.debug=
New registration email debugging switch (see appCtx.mail.xml
), e.g. (true|false)
.
multipart.fileupload.maxinmemorysize=
From the Spring docs :
Set the maximum allowed size (in bytes) before uploads are written to disk. Uploaded files will still be received past this amount, but they will not be stored in memory. Default is 10240, according to Commons FileUpload.
multipart.fileupload.maxuploadsize=
From the docs here :
Set the maximum allowed size (in bytes) before uploads are refused. -1 indicates no limit (the default).
log.file.client_shared=
Component log file location on disk, e.g. ‘logs/client-shared.log’.
log.level.client_shared=
Component log level, e.g. (trace|debug|info|warn|error|fatal)
.
log.level.general=
Log level of code from other libraries, e.g. (trace|debug|info|warn|error|fatal)
.
Deploy¶
This component when built should not be deployed into a servlet container,
instead it is Maven-install
ed in the local Maven repository
and then a subsequent build of client
and/or client-direct
retrieves the
built files and uses them.
Done that! What’s next?¶
Conventionally the next step, having built and Maven-install
ed
client-shared
, would be to build client
and/or client-direct
.
This is because both of client
and client-direct
are dependent on
client-shared
(and client-parent
) and need to be kept in-sync.
Footnotes
[1] | Since early 2019. |