Skip to content

Commit 63bec0d

Browse files
committed
changing url path structure to resource-docs
1 parent ed5de46 commit 63bec0d

17 files changed

Lines changed: 163 additions & 111 deletions

.env.example

Lines changed: 35 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,35 @@
1-
VITE_OBP_API_HOST=https://apisandbox.openbankproject.com
2-
3-
### OBP-API mode ###################################
4-
# If OBP-API split to two instances, eg: apis,portal
5-
# Then API_Explorer need to set two api hosts: api_hostname and this api_portal_hostname, for all Rest Apis will call api_hostname
6-
# but for all the portal home page link, we need to use this props. If do not set this, it will use api_hostname value instead.
7-
VITE_OBP_API_PORTAL_HOST=https://apisandbox.openbankproject.com
8-
####################################################################################
9-
10-
VITE_OBP_API_VERSION=v6.0.0
11-
#The default version of the root page, it has the default value `OBP+VITE_OBP_API_VERSION`
12-
#The format must follow standard+Version, e.g., OBPv5.1.0, BGv1, or BGv1.3.
13-
#VITE_OBP_API_DEFAULT_RESOURCE_DOC_VERSION=OBPv6.0.0
14-
15-
# API Manager
16-
VITE_OBP_API_MANAGER_HOST=https://apimanagersandbox.openbankproject.com
17-
VITE_SHOW_API_MANAGER_BUTTON=false
18-
19-
VITE_OBP_API_EXPLORER_HOST=http://localhost:5173
20-
VITE_OBP_CONSUMER_KEY=your_consumer_key
21-
VITE_OBP_CONSUMER_SECRET=your_consumer_secret
22-
VITE_OBP_REDIRECT_URL=http://localhost:5173/api/callback
23-
VITE_OPB_SERVER_SESSION_PASSWORD=very secret
24-
# The above code connects to localhost on port 6379.
25-
# To connect to a different host or port, use a connection string in the format
26-
# redis[s]://[[username][:password]@][host][:port][/db-number]
27-
# Be sure to secure your Redis instance
28-
VITE_OBP_REDIS_URL = redis://127.0.0.1:6379
29-
30-
# Enable the chatbot interface "Opey"
31-
# Note: For Opey to be connected you will need to create a public key for API Explorer II
32-
# To do this:
33-
VITE_CHATBOT_ENABLED=false
34-
VITE_CHATBOT_URL=http://localhost:5000
35-
VITE_OPEY_CONSUMER_ID=opey_consumer_id # For granting a consent to Opey
36-
37-
# Product styling setting
38-
#VITE_OBP_LINKS_COLOR="#52b165"
39-
#VITE_OBP_HEADER_LINKS_COLOR="#39455f"
40-
#VITE_OBP_HEADER_LINKS_HOVER_COLOR="#39455f"
41-
#VITE_OBP_HEADER_LINKS_BACKGROUND_COLOR="#eef0f4"
42-
#VITE_OBP_LOGO_URL=https://static.openbankproject.com/images/obp_logo.png
43-
44-
# https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production
45-
# The value could be: development, staging, production
46-
# NODE_ENV=development
47-
48-
# If you have a problem with session storage (which will cause problems with login) you can enable this. See README for further info.
49-
#DEBUG=express-session
1+
### OBP-API Configuration ###
2+
VITE_OBP_API_PORTAL_HOST=http://127.0.0.1:8080 # OBP API Portal URL (for "Portal Home" navigation link)
3+
VITE_OBP_API_HOST=http://127.0.0.1:8080 # OBP API server base URL (for all backend API requests)
4+
# VITE_OBP_API_VERSION is NO LONGER USED - hardcoded to v5.1.0 in shared-constants.ts for stability
5+
VITE_OBP_API_MANAGER_HOST=https://apimanagersandbox.openbankproject.com # OBP API Manager URL (optional - for navigation link)
6+
VITE_OBP_API_EXPLORER_HOST=http://localhost:5173 # API Explorer application URL (used for OAuth2 redirects and internal routing)
7+
VITE_OPB_SERVER_SESSION_PASSWORD=your-secret-session-password-here # Secret key for session encryption (keep this secure!)
8+
VITE_SHOW_API_MANAGER_BUTTON=false # Show/hide API Manager button in navigation (true/false)
9+
10+
### Redis Configuration ###
11+
VITE_OBP_REDIS_URL=redis://127.0.0.1:6379 # Redis connection string for session storage (format: redis://host:port)
12+
13+
### Opey Configuration ###
14+
VITE_CHATBOT_ENABLED=false # Enable/disable Opey chatbot widget (true/false)
15+
VITE_CHATBOT_URL=http://localhost:5000 # Opey chatbot service URL (only needed if chatbot is enabled)
16+
17+
### OAuth2/OIDC Configuration ###
18+
VITE_OBP_OAUTH2_CLIENT_ID=48ac28e9-9ee3-47fd-8448-69a62764b779 # OAuth2 client ID (UUID - must match OIDC server registration)
19+
VITE_OBP_OAUTH2_CLIENT_SECRET=fOTQF7jfg8C74u7ZhSjVQpoBYvD0KpWfM5UsEZBSFFM # OAuth2 client secret (keep this secure!)
20+
VITE_OBP_OAUTH2_REDIRECT_URL=http://localhost:5173/api/oauth2/callback # OAuth2 callback URL (must exactly match OIDC client registration)
21+
VITE_OBP_OAUTH2_WELL_KNOWN_URL=http://localhost:9000/obp-oidc/.well-known/openid-configuration # OIDC discovery endpoint URL
22+
VITE_OBP_OAUTH2_TOKEN_REFRESH_THRESHOLD=300 # Seconds before token expiry to trigger refresh (default: 300)
23+
24+
### Resource Documentation Version (Optional) ###
25+
# VITE_OBP_API_DEFAULT_RESOURCE_DOC_VERSION=OBPv5.1.0 # Default resource docs version for frontend URLs (format: OBPv5.1.0 - with OBP prefix, auto-constructed if not set)
26+
27+
### Session Configuration (Optional) ###
28+
# VITE_SESSION_MAX_AGE=3600 # Session timeout in seconds (default: 3600 = 1 hour)
29+
30+
### Styling Configuration (Optional) ###
31+
# VITE_OBP_LOGO_URL=https://example.com/logo.png # Custom logo image URL (uses default OBP logo if not set)
32+
# VITE_OBP_LINKS_COLOR=#3c8dbc # Primary link color (CSS color value)
33+
# VITE_OBP_HEADER_LINKS_COLOR=#39455f # Header navigation link color
34+
# VITE_OBP_HEADER_LINKS_HOVER_COLOR=#39455f # Header navigation link hover color
35+
# VITE_OBP_HEADER_LINKS_BACKGROUND_COLOR=#eef0f4 # Header navigation active link background color

server/controllers/StatusController.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ import OBPClientService from '../services/OBPClientService'
3232
import { Service, Container } from 'typedi'
3333
import { OAuthConfig } from 'obp-typescript'
3434
import { commitId } from '../app'
35+
import {
36+
RESOURCE_DOCS_API_VERSION,
37+
MESSAGE_DOCS_API_VERSION,
38+
API_VERSIONS_LIST_API_VERSION
39+
} from '../../shared-constants'
3540

3641
@Service()
3742
@Controller('/status')
@@ -104,7 +109,7 @@ export class StatusController {
104109

105110
async checkResourceDocs(oauthConfig: OAuthConfig, version: string): Promise<boolean> {
106111
try {
107-
const path = `/obp/${version}/resource-docs/${version}/obp`
112+
const path = `/obp/${RESOURCE_DOCS_API_VERSION}/resource-docs/${version}/obp`
108113
const resourceDocs = await this.obpClientService.get(path, oauthConfig)
109114
return !this.isCodeError(resourceDocs, path)
110115
} catch (error) {
@@ -115,7 +120,7 @@ export class StatusController {
115120
try {
116121
const messageDocsCodeResult = await Promise.all(
117122
this.connectors.map(async (connector) => {
118-
const path = `/obp/${version}/message-docs/${connector}`
123+
const path = `/obp/${MESSAGE_DOCS_API_VERSION}/message-docs/${connector}`
119124
return !this.isCodeError(await this.obpClientService.get(path, oauthConfig), path)
120125
})
121126
)
@@ -127,7 +132,7 @@ export class StatusController {
127132

128133
async checkApiVersions(oauthConfig: OAuthConfig, version: string): Promise<boolean> {
129134
try {
130-
const path = `/obp/${version}/api/versions`
135+
const path = `/obp/${API_VERSIONS_LIST_API_VERSION}/api/versions`
131136
const versions = await this.obpClientService.get(path, oauthConfig)
132137
return !this.isCodeError(versions, path)
133138
} catch (error) {

server/controllers/UserController.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ export class UserController {
136136

137137
if (clientConfig && clientConfig.oauth2?.accessToken) {
138138
try {
139-
const version = process.env.VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION
139+
// Always use v5.1.0 for application infrastructure - stable and debuggable
140+
const version = DEFAULT_OBP_API_VERSION
140141
console.log('UserController: Fetching OBP user from /obp/' + version + '/users/current')
141142
const obpUser = await this.obpClientService.get(
142143
`/obp/${version}/users/current`,

server/middlewares/OAuth2CallbackMiddleware.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { ExpressMiddlewareInterface } from 'routing-controllers'
2929
import { Request, Response } from 'express'
3030
import { Service, Container } from 'typedi'
3131
import { OAuth2Service } from '../services/OAuth2Service'
32+
import { DEFAULT_OBP_API_VERSION } from '../../shared-constants'
3233
import jwt from 'jsonwebtoken'
3334

3435
/**
@@ -317,9 +318,11 @@ export default class OAuth2CallbackMiddleware implements ExpressMiddlewareInterf
317318

318319
// Create clientConfig for OBP API calls with OAuth2 Bearer token
319320
// This allows OBPClientService to work with OAuth2 authentication
321+
// Store session data for authenticated requests
322+
// Always use v5.1.0 for application infrastructure - stable and debuggable
320323
session['clientConfig'] = {
321324
baseUri: process.env.VITE_OBP_API_HOST || 'http://localhost:8080',
322-
version: process.env.VITE_OBP_API_VERSION || 'v5.1.0',
325+
version: DEFAULT_OBP_API_VERSION,
323326
oauth2: {
324327
accessToken: tokens.accessToken,
325328
tokenType: tokens.tokenType || 'Bearer'

server/services/OBPClientService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ export default class OBPClientService {
7272
constructor() {
7373
if (!process.env.VITE_OBP_API_HOST) throw new Error('VITE_OBP_API_HOST is not set')
7474

75+
// Always use v5.1.0 for application infrastructure - stable and debuggable
7576
this.clientConfig = {
7677
baseUri: process.env.VITE_OBP_API_HOST!,
77-
version: process.env.VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION
78+
version: DEFAULT_OBP_API_VERSION
7879
}
7980
}
8081
async get(path: string, clientConfig: any): Promise<any> {

server/services/OBPConsentsService.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ export default class OBPConsentsService {
9090
// I.e. give permission to Opey to do anything on behalf of the logged in user
9191

9292
// Get the Consents API client from the OBP SDK
93+
// Always use v5.1.0 for application infrastructure - stable and debuggable
9394
const client = await this.createUserConsentsClient(
9495
session,
95-
`/obp/${process.env.VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION}/my/consents/IMPLICIT`,
96+
`/obp/${DEFAULT_OBP_API_VERSION}/my/consents/IMPLICIT`,
9697
'POST'
9798
)
9899
if (!client) {
@@ -161,8 +162,9 @@ export default class OBPConsentsService {
161162
}
162163

163164
try {
165+
// Always use v5.1.0 for application infrastructure - stable and debuggable
164166
const response = await this._sendOBPRequest(
165-
`/obp/${process.env.VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION}/user/current/consents/${consentId}`,
167+
`/obp/${DEFAULT_OBP_API_VERSION}/user/current/consents/${consentId}`,
166168
'GET',
167169
clientConfig
168170
)
@@ -212,8 +214,9 @@ export default class OBPConsentsService {
212214

213215
// We need to change this back to consent infos once OBP shows 'EXPIRED' in the status
214216
// Right now we have to check the JWT ourselves
215-
const consentInfosPath = `/obp/${process.env.VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION}/my/consents`
216-
//const consentInfosPath = `/obp/${process.env.VITE_OBP_API_VERSION ?? DEFAULT_OBP_API_VERSION}/my/consent-infos`
217+
// Always use v5.1.0 for application infrastructure - stable and debuggable
218+
const consentInfosPath = `/obp/${DEFAULT_OBP_API_VERSION}/my/consents`
219+
//const consentInfosPath = `/obp/${DEFAULT_OBP_API_VERSION}/my/consent-infos`
217220

218221
let opeyConsentId: string | null = null
219222
try {

shared-constants.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
11
// DEFAULT_OBP_API_VERSION is used in case the environment variable VITE_OBP_API_VERSION is not set
2-
export const DEFAULT_OBP_API_VERSION = 'v6.0.0'
2+
export const DEFAULT_OBP_API_VERSION = 'v5.1.0'
3+
4+
// Hardcoded API versions for all application endpoints
5+
// Using v5.1.0 as the standard stable version - more stable than v6.0.0 and bugs can be fixed
6+
// These versions should NOT change based on user's documentation version selection in the UI
7+
8+
/**
9+
* Resource documentation endpoint version
10+
* Endpoint: GET /obp/{version}/resource-docs/{docVersion}/obp
11+
*/
12+
export const RESOURCE_DOCS_API_VERSION = 'v5.1.0'
13+
14+
/**
15+
* Message documentation endpoint version
16+
* Endpoint: GET /obp/{version}/message-docs/{connector}
17+
*/
18+
export const MESSAGE_DOCS_API_VERSION = 'v5.1.0'
19+
20+
/**
21+
* API versions list endpoint version
22+
* Endpoint: GET /obp/{version}/api/versions
23+
*/
24+
export const API_VERSIONS_LIST_API_VERSION = 'v5.1.0'
25+
26+
/**
27+
* Glossary endpoint version
28+
* Endpoint: GET /obp/{version}/api/glossary
29+
*/
30+
export const GLOSSARY_API_VERSION = 'v5.1.0'

src/components/AutoLogout.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import { ElNotification, NotificationHandle } from 'element-plus';
33
import { ref, computed, h, onMounted, onBeforeUnmount } from 'vue';
4+
import { DEFAULT_OBP_API_VERSION } from '../../shared-constants';
45
56
// Props can be defined with defineProps
67
const props = defineProps({
@@ -37,7 +38,8 @@ async function getOBPSuggestedTimeout() {
3738
let timeoutInSeconds: number;
3839
// Fetch the suggested timeout from the OBP API
3940
40-
const response = await fetch(`${obpApiHost}/obp/${import.meta.env.VITE_OBP_API_VERSION}/ui/suggested-session-timeout`);
41+
// Always use v5.1.0 for application infrastructure - stable and debuggable
42+
const response = await fetch(`${obpApiHost}/obp/${DEFAULT_OBP_API_VERSION}/ui/suggested-session-timeout`);
4143
const json = await response.json();
4244
if(json.timeout_in_seconds) {
4345
timeoutInSeconds = json.timeout_in_seconds;
@@ -48,7 +50,7 @@ async function getOBPSuggestedTimeout() {
4850
}
4951
5052
return timeoutInSeconds;
51-
}
53+
}
5254
5355
function resetTimeout() {
5456
// Logic to reset the timeout
@@ -72,14 +74,14 @@ function warningMessage() {
7274
// Update the countdown every second
7375
countdownInterval = setInterval(() => {
7476
secondsLeft.value = Math.ceil((logoutTime - Date.now()) / 1000);
75-
77+
7678
// If time's up or almost up, clear the interval
7779
if (secondsLeft.value <= 0) {
7880
clearInterval(countdownInterval);
7981
return;
8082
}
81-
82-
83+
84+
8385
}, 1000);
8486
8587
warningNotification = ElNotification({
@@ -117,11 +119,11 @@ onMounted(() => {
117119
const logoutDelay = timeoutInSeconds * 1000;
118120
// Set warning to appear 30 seconds before logout
119121
const warningDelay = Math.max(logoutDelay - 30000, 0);
120-
122+
121123
// Update the defaults
122124
defaultWarningDelay = warningDelay;
123125
defaultLogoutDelay = logoutDelay;
124-
126+
125127
// Reset timers with new values
126128
resetTimeout();
127129
}).catch(error => {
@@ -154,4 +156,4 @@ onBeforeUnmount(() => {
154156
<div>
155157
<!-- Your component content here -->
156158
</div>
157-
</template>
159+
</template>

src/components/Content.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { ElNotification } from 'element-plus'
3232
import { inject, onMounted, provide, ref } from 'vue'
3333
import { onBeforeRouteUpdate, useRoute } from 'vue-router'
3434
import {
35-
OBP_API_VERSION,
35+
OBP_API_DEFAULT_RESOURCE_DOC_VERSION,
3636
createMyAPICollection,
3737
createMyAPICollectionEndpoint,
3838
deleteMyAPICollectionEndpoint,
@@ -43,7 +43,7 @@ import { SUMMARY_PAGER_LINKS_COLOR as summaryPagerLinksColorSetting } from '../o
4343
import { initializeAPICollections, setTabActive } from './SearchNav.vue'
4444
4545
const route = useRoute()
46-
const obpVersion = 'OBP' + OBP_API_VERSION
46+
const obpVersion = OBP_API_DEFAULT_RESOURCE_DOC_VERSION
4747
const description = ref('')
4848
const summary = ref('')
4949
const resourceDocs = inject(obpResourceDocsKey)
@@ -142,15 +142,15 @@ const showNotification = (message: string, type: string): void => {
142142
}
143143
144144
onMounted(async () => {
145-
routeId = route.params.id
146-
version = route.query.version ? route.query.version : obpVersion
145+
routeId = route.query.operationid
146+
version = route.params.version ? route.params.version : obpVersion
147147
setOperationDetails(routeId, version)
148148
setPager(routeId)
149149
await tagFavoriteButton(routeId)
150150
})
151151
onBeforeRouteUpdate(async (to) => {
152-
routeId = to.params.id
153-
version = route.query.version ? route.query.version : obpVersion
152+
routeId = to.query.operationid
153+
version = to.params.version ? to.params.version : obpVersion
154154
setOperationDetails(routeId, version)
155155
setPager(routeId)
156156
await tagFavoriteButton(routeId)
@@ -180,12 +180,12 @@ onBeforeRouteUpdate(async (to) => {
180180
<ArrowLeftBold />
181181
</el-icon>
182182
<RouterLink v-show="displayPrev" class="pager-router-link"
183-
:to="{ name: 'api', params: { id: prev.id }, query: { version: prev.version } }">{{ prev.title }}
183+
:to="{ name: 'api', params: { version: prev.version }, query: { operationid: prev.id } }">{{ prev.title }}
184184
</RouterLink>
185185
</el-col>
186186
<el-col :span="12" class="pager-right">
187187
<RouterLink v-show="displayNext" class="pager-router-link"
188-
:to="{ name: 'api', params: { id: next.id }, query: { version: next.version } }">{{ next.title }}
188+
:to="{ name: 'api', params: { version: next.version }, query: { operationid: next.id } }">{{ next.title }}
189189
</RouterLink>
190190
<el-icon v-show="displayNext">
191191
<ArrowRightBold />

src/components/HeaderNav.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import { ref, inject, watchEffect, onMounted, computed } from 'vue'
3030
import { ArrowDown } from '@element-plus/icons-vue'
3131
import { useRoute, useRouter } from 'vue-router'
32-
import { OBP_API_VERSION, getCurrentUser } from '../obp'
32+
import { OBP_API_DEFAULT_RESOURCE_DOC_VERSION, getCurrentUser } from '../obp'
3333
import { getOBPAPIVersions } from '../obp/api-version'
3434
import {
3535
LOGO_URL as logoSource,
@@ -84,7 +84,7 @@ const handleMore = (command: string) => {
8484
if (command.includes('_')) {
8585
router.push({ name: 'message-docs', params: { id: command } })
8686
} else {
87-
router.replace({ path: '/operationid', query: { version: command } })
87+
router.replace({ path: `/resource-docs/${command}` })
8888
}
8989
}
9090
@@ -129,7 +129,7 @@ const getCurrentPath = () => {
129129
<a v-bind:href="obpApiHybridPost" class="router-link" id="header-nav-home">
130130
{{ $t('header.portal_home') }}
131131
</a>
132-
<RouterLink class="router-link" id="header-nav-tags" :to="'/operationid?version=OBP' + OBP_API_VERSION">{{
132+
<RouterLink class="router-link" id="header-nav-tags" :to="'/resource-docs/' + OBP_API_DEFAULT_RESOURCE_DOC_VERSION">{{
133133
$t('header.api_explorer') }}</RouterLink>
134134
<RouterLink class="router-link" id="header-nav-glossary" to="/glossary">{{
135135
$t('header.glossary')

0 commit comments

Comments
 (0)