mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:37:00 +00:00
feature/Add glossary items via markdown files
This commit is contained in:
parent
cdcb5548ff
commit
bc861d008b
51
README.md
51
README.md
@ -58,56 +58,7 @@ To compile and run jetty, install Maven 3, create your configuration in obp-api/
|
||||
|
||||
mvn install -pl .,obp-commons && mvn jetty:run -pl obp-api
|
||||
|
||||
## To run via IntelliJ IDEA
|
||||
|
||||
* Make sure you have the IntelliJ Scala plugin installed.
|
||||
|
||||
* Create a new folder e.g. OpenBankProject and cd there
|
||||
|
||||
* git clone https://github.com/OpenBankProject/OBP-API.git
|
||||
|
||||
* In IntelliJ IDEA do File -> New -> Project from existing sources, navigate to the folder and select pom.xml
|
||||
|
||||
* Alternatively you can do File -> New -> Project from VCS and checkout the project directly from github.
|
||||
|
||||
* When / if prompted for SDK, choose Java 1.8 (and Scala 2.12) otherwise keep the defaults. Use the Maven options. Do not change the project name etc.
|
||||
|
||||
* If you see a message about an unmanaged pom.xml, click the option to let Maven manage it.
|
||||
|
||||
* Navigate to obp-api/test/scala/code/RunWebApp. You may see a Setup Scala SDK link. Click this and check Scala 2.12.12 or so.
|
||||
|
||||
* In obp-api/src/main/resources/props create a \<yourloginname\>.props (or default.props) for development. Set connector=mapped
|
||||
|
||||
* Now **Rebuild** the project so everything is compiled. At this point you may need to select the SDK, see above.
|
||||
|
||||
* Once you have rebuilt the project without compile errors, you should be able to RunWebApp/RunTLSWebApp/RunMTLSWebApp in obp-api/src/test/scala
|
||||
|
||||
* If you have trouble (re)building, try using the IntelliJ IDEA terminal: mvn clean test-compile
|
||||
|
||||
### To run via IntelliJ IDEA in development mode without secure connection
|
||||
|
||||
* Run RunWebApp by right clicking on it or selecting Run. The built in jetty server should start on localhost:8080
|
||||
|
||||
* Browse to localhost:8080 but don't try anything else there yet.
|
||||
|
||||
### To run via IntelliJ IDEA in TLS development mode (secure connection)
|
||||
|
||||
* Run RunTLSWebApp by right clicking on it and selecting Run/Debug. The built in jetty server should start on localhost:8080
|
||||
|
||||
* Browse to localhost:8080 but don't try anything else there yet
|
||||
|
||||
In `development` mode we use this option in order to try OpenID Connect functionality. I.e. redirect URI must be `https` one.
|
||||
|
||||
### To run ia IntelliJ IDEA in MTLS development mode (secure connection)
|
||||
|
||||
* Run RunMTLSWebApp by right clicking on it and selecting Run/Debug. The built in jetty server should start on localhost:8080
|
||||
|
||||
* Import certificate obp-api/src/test/resources/cert/localhost_SAN_dns_ip.pfx into your browser.
|
||||
|
||||
* Browse to localhost:8080 but don't try anything else there yet
|
||||
|
||||
In `development` mode we use this option in order to try UK Open Banking APIs functionality where mutual TLS is part of that standard.
|
||||
|
||||
[Note: How to run via IntelliJ IDEA](docs/glossary/Run via IntelliJ IDEA.md)
|
||||
|
||||
## Run some tests.
|
||||
|
||||
|
||||
49
docs/glossary/Run via IntelliJ IDEA.md
Normal file
49
docs/glossary/Run via IntelliJ IDEA.md
Normal file
@ -0,0 +1,49 @@
|
||||
## To run via IntelliJ IDEA
|
||||
|
||||
* Make sure you have the IntelliJ Scala plugin installed.
|
||||
|
||||
* Create a new folder e.g. OpenBankProject and cd there
|
||||
|
||||
* git clone https://github.com/OpenBankProject/OBP-API.git
|
||||
|
||||
* In IntelliJ IDEA do File -> New -> Project from existing sources, navigate to the folder and select pom.xml
|
||||
|
||||
* Alternatively you can do File -> New -> Project from VCS and checkout the project directly from github.
|
||||
|
||||
* When / if prompted for SDK, choose Java 1.8 (and Scala 2.12) otherwise keep the defaults. Use the Maven options. Do not change the project name etc.
|
||||
|
||||
* If you see a message about an unmanaged pom.xml, click the option to let Maven manage it.
|
||||
|
||||
* Navigate to obp-api/test/scala/code/RunWebApp. You may see a Setup Scala SDK link. Click this and check Scala 2.12.12 or so.
|
||||
|
||||
* In obp-api/src/main/resources/props create a \<yourloginname\>.props (or default.props) for development. Set connector=mapped
|
||||
|
||||
* Now **Rebuild** the project so everything is compiled. At this point you may need to select the SDK, see above.
|
||||
|
||||
* Once you have rebuilt the project without compile errors, you should be able to RunWebApp/RunTLSWebApp/RunMTLSWebApp in obp-api/src/test/scala
|
||||
|
||||
* If you have trouble (re)building, try using the IntelliJ IDEA terminal: mvn clean test-compile
|
||||
|
||||
### To run via IntelliJ IDEA in development mode without secure connection
|
||||
|
||||
* Run RunWebApp by right clicking on it or selecting Run. The built in jetty server should start on localhost:8080
|
||||
|
||||
* Browse to localhost:8080 but don't try anything else there yet.
|
||||
|
||||
### To run via IntelliJ IDEA in TLS development mode (secure connection)
|
||||
|
||||
* Run RunTLSWebApp by right clicking on it and selecting Run/Debug. The built in jetty server should start on localhost:8080
|
||||
|
||||
* Browse to localhost:8080 but don't try anything else there yet
|
||||
|
||||
In `development` mode we use this option in order to try OpenID Connect functionality. I.e. redirect URI must be `https` one.
|
||||
|
||||
### To run via IntelliJ IDEA in MTLS development mode (secure connection)
|
||||
|
||||
* Run RunMTLSWebApp by right clicking on it and selecting Run/Debug. The built in jetty server should start on localhost:8080
|
||||
|
||||
* Import certificate obp-api/src/test/resources/cert/localhost_SAN_dns_ip.pfx into your browser.
|
||||
|
||||
* Browse to localhost:8080 but don't try anything else there yet
|
||||
|
||||
In `development` mode we use this option in order to try UK Open Banking APIs functionality where mutual TLS is part of that standard.
|
||||
@ -1,12 +1,15 @@
|
||||
package code.api.util
|
||||
|
||||
import java.io.File
|
||||
|
||||
import code.api.Constant.PARAM_LOCALE
|
||||
import code.api.util.APIUtil.{getOAuth2ServerUrl, getObpApiRoot, getServerUrl}
|
||||
import code.api.util.APIUtil.{getObpApiRoot, getServerUrl}
|
||||
import code.api.util.ExampleValue.{accountIdExample, bankIdExample, customerIdExample, userIdExample}
|
||||
import code.util.Helper.MdcLoggable
|
||||
import code.webuiprops.MappedWebUiPropsProvider.getWebUiPropsValue
|
||||
import net.liftweb.http.LiftRules
|
||||
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import code.webuiprops.MappedWebUiPropsProvider.getWebUiPropsValue
|
||||
|
||||
|
||||
object Glossary extends MdcLoggable {
|
||||
@ -3106,7 +3109,36 @@ object Glossary extends MdcLoggable {
|
||||
|""".stripMargin)
|
||||
|
||||
|
||||
private def getContentFromMarkdownFile(path: String): String = {
|
||||
val source = scala.io.Source.fromFile(path)
|
||||
val lines: String = try source.mkString finally source.close()
|
||||
lines
|
||||
}
|
||||
|
||||
private def getListOfFiles():List[File] = {
|
||||
val dir= LiftRules.getResource("/")
|
||||
.map(_.toURI.getPath
|
||||
.replace("obp-api/src/main/webapp", "docs/glossary"))
|
||||
val d = new File(dir.getOrElse(""))
|
||||
if (d.exists && d.isDirectory) {
|
||||
d.listFiles.filter(_.isFile).filter(_.getName.endsWith(".md")).toList
|
||||
} else {
|
||||
List[File]()
|
||||
}
|
||||
}
|
||||
|
||||
// Append all files from /OBP-API/docs/glossary as items
|
||||
// File name is used as a title
|
||||
// File content is used as a description
|
||||
glossaryItems.appendAll(
|
||||
getListOfFiles().map(file =>
|
||||
GlossaryItem(
|
||||
title = file.getName,
|
||||
description = getContentFromMarkdownFile(file.getPath)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// NOTE! Some glossary items are generated in ExampleValue.scala
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
3
obp-api/src/main/scala/code/api/util/test.md
Normal file
3
obp-api/src/main/scala/code/api/util/test.md
Normal file
@ -0,0 +1,3 @@
|
||||
#What is mutual TLS (mTLS)?
|
||||
|
||||
Mutual TLS (mTLS) is a type of authentication in which the two parties in a connection authenticate each other using the TLS protocol.
|
||||
Loading…
Reference in New Issue
Block a user