Skip to content

Commit

Permalink
Fix #1569: NextStep Home Page (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnpsk authored Feb 13, 2024
1 parent 117525f commit 58acf77
Show file tree
Hide file tree
Showing 14 changed files with 346 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .run/NextStepApplication.run.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="NextStepApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<option name="DEBUG_MODE" value="true" />
<module name="powerauth-nextstep" />
<option name="SPRING_BOOT_MAIN_CLASS" value="io.getlime.security.powerauth.app.nextstep.NextStepApplication" />
<option name="VM_PARAMETERS" value="-Dserver.servlet.context-path=/powerauth-nextstep -Dserver.port=9082" />
<option name="WORKING_DIRECTORY" value="file://$MODULE_WORKING_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
<option name="Maven.BeforeRunTask" enabled="true" file="$PROJECT_DIR$/powerauth-nextstep/pom.xml" goal="process-resources" />
Expand Down
2 changes: 2 additions & 0 deletions .run/TppEngineApplication.run.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="TppEngineApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="ACTIVE_PROFILES" value="dev" />
<option name="DEBUG_MODE" value="true" />
<module name="powerauth-tpp-engine" />
<option name="SPRING_BOOT_MAIN_CLASS" value="io.getlime.security.powerauth.app.tppengine.TppEngineApplication" />
<option name="VM_PARAMETERS" value="-Dserver.servlet.context-path=/tpp-engine -Dserver.port=9081" />
<option name="WORKING_DIRECTORY" value="file://$MODULE_WORKING_DIR$" />
<method v="2">
<option name="Make" enabled="true" />
<option name="Maven.BeforeRunTask" enabled="true" file="$PROJECT_DIR$/powerauth-tpp-engine/pom.xml" goal="process-resources" />
Expand Down
4 changes: 4 additions & 0 deletions powerauth-nextstep/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<!-- PowerAuth Dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* PowerAuth Web Flow and related software components
* Copyright (C) 2024 Wultra s.r.o.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package io.getlime.security.powerauth.app.nextstep.controller;

import io.getlime.security.powerauth.app.nextstep.configuration.NextStepServerConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.info.BuildProperties;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
* Home controller to display welcome page.
*
* @author Jan Pesek, [email protected]
*/
@Controller
public class HomeController {

private final BuildProperties buildProperties;
private final NextStepServerConfiguration nextStepServerConfiguration;

public HomeController(@Autowired(required = false) final BuildProperties buildProperties,
final NextStepServerConfiguration nextStepServerConfiguration) {
this.buildProperties = buildProperties;
this.nextStepServerConfiguration = nextStepServerConfiguration;
}

@SuppressWarnings("SameReturnValue")
@GetMapping(value = "/", produces = MediaType.TEXT_HTML_VALUE)
public String home(Model model) {
if (buildProperties != null) {
model.addAttribute("version", buildProperties.getVersion());
model.addAttribute("buildTime", buildProperties.getTime());
}

model.addAttribute("applicationName", nextStepServerConfiguration.getApplicationName());
model.addAttribute("applicationDisplayName", nextStepServerConfiguration.getApplicationDisplayName());
model.addAttribute("applicationEnvironment", nextStepServerConfiguration.getApplicationEnvironment());

return "index";
}

}
83 changes: 83 additions & 0 deletions powerauth-nextstep/src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!--
~ PowerAuth Web Flow and related software components
~ Copyright (C) 2024 Wultra s.r.o.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as published
~ by the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="resources/css/bootstrap.min.css"/>
<title>PowerAuth Next Step Server</title>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mt-3 rounded">
<a class="navbar-brand" href="#">
<img src="resources/image/wultra-square.svg" width="30" height="30" alt="Wultra Logo" class="mr-2">
<strong>PowerAuth Next Step Server</strong>
</a>
</nav>

<div class="row mt-3">
<div class="col-sm-7">
<div class="card mb-3">
<h5 class="card-header">System Information</h5>
<div class="card-body">
<div class="card-text">
<p>Version: <strong th:text="${version} ?: 'UNKNOWN'"/></p>
<p>Build Time: <strong th:text="${buildTime} ?: 'UNKNOWN'"/></p>
<p>Application Name: <strong th:text="${applicationName} ?: 'UNKNOWN'"/></p>
<p>Application Display Name: <strong th:text="${applicationDisplayName} ?: 'UNKNOWN'"/></p>
<p>Application Environment: <strong th:text="${applicationEnvironment}"/></p>
</div>
</div>
</div>
<div class="card mb-3">
<h5 class="card-header">Available Interfaces</h5>
<ul class="list-group list-group-flush">
<li class="list-group-item d-flex justify-content-between align-items-center">
<a href="swagger-ui.html">PowerAuth Next Step Server RESTful API</a>
<span class="badge badge-secondary badge-pill">Swagger</span>
</li>
</ul>
</div>
</div>
<div class="col-sm-5">
<div class="card mb-3">
<h5 class="card-header">Quick Links</h5>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a target="_blank" href="https://developers.wultra.com/components">Technical Documentation of Wultra Components</a></li>
<li class="list-group-item"><a target="_blank" href="https://github.com/wultra/powerauth-webflow">GitHub Develop Repository</a></li>
<li class="list-group-item"><a target="_blank" href="https://github.com/wultra/powerauth-webflow/issues">Report Issue</a></li>
</ul>
</div>
<div class="card mb-3">
<h5 class="card-header">Contact Us</h5>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a target="_blank" href="https://wultra.com">🔗 Website</a></li>
<li class="list-group-item"><a target="_blank" href="https://wultra.com/discord">💬 Discord Chat</a></li>
<li class="list-group-item"><a href="mailto:[email protected]">✉️ E-mail</a></li>
</ul>
</div>
</div>
</div>
</div>
<footer class="container mt-3">
<p>&copy; <span th:text="${#dates.year(#dates.createNow())}">2020</span> <a target="_blank" href="https://wultra.com">Wultra s.r.o.</a></p>
</footer>
</body>
</html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions powerauth-tpp-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<!-- PowerAuth Dependencies -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* PowerAuth Web Flow and related software components
* Copyright (C) 2024 Wultra s.r.o.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package io.getlime.security.powerauth.app.tppengine.controller;

import io.getlime.security.powerauth.app.tppengine.configuration.TppEngineConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.info.BuildProperties;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
* Home controller to display welcome page.
*
* @author Jan Pesek, [email protected]
*/
@Controller
public class HomeController {

private final BuildProperties buildProperties;
private final TppEngineConfiguration tppEngineConfiguration;

public HomeController(@Autowired(required = false) final BuildProperties buildProperties,
final TppEngineConfiguration tppEngineConfiguration) {
this.buildProperties = buildProperties;
this.tppEngineConfiguration = tppEngineConfiguration;
}

@SuppressWarnings("SameReturnValue")
@GetMapping(value = "/", produces = MediaType.TEXT_HTML_VALUE)
public String home(Model model) {
if (buildProperties != null) {
model.addAttribute("version", buildProperties.getVersion());
model.addAttribute("buildTime", buildProperties.getTime());
}

model.addAttribute("applicationName", tppEngineConfiguration.getApplicationName());
model.addAttribute("applicationDisplayName", tppEngineConfiguration.getApplicationDisplayName());
model.addAttribute("applicationEnvironment", tppEngineConfiguration.getApplicationEnvironment());

return "index";
}

}
83 changes: 83 additions & 0 deletions powerauth-tpp-engine/src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<!--
~ PowerAuth Web Flow and related software components
~ Copyright (C) 2024 Wultra s.r.o.
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as published
~ by the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="resources/css/bootstrap.min.css"/>
<title>PowerAuth Third Party Provider Engine</title>
</head>
<body>
<div class="container">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark mt-3 rounded">
<a class="navbar-brand" href="#">
<img src="resources/image/wultra-square.svg" width="30" height="30" alt="Wultra Logo" class="mr-2">
<strong>PowerAuth Third Party Provider Engine</strong>
</a>
</nav>

<div class="row mt-3">
<div class="col-sm-7">
<div class="card mb-3">
<h5 class="card-header">System Information</h5>
<div class="card-body">
<div class="card-text">
<p>Version: <strong th:text="${version} ?: 'UNKNOWN'"/></p>
<p>Build Time: <strong th:text="${buildTime} ?: 'UNKNOWN'"/></p>
<p>Application Name: <strong th:text="${applicationName} ?: 'UNKNOWN'"/></p>
<p>Application Display Name: <strong th:text="${applicationDisplayName} ?: 'UNKNOWN'"/></p>
<p>Application Environment: <strong th:text="${applicationEnvironment}"/></p>
</div>
</div>
</div>
<div class="card mb-3">
<h5 class="card-header">Available Interfaces</h5>
<ul class="list-group list-group-flush">
<li class="list-group-item d-flex justify-content-between align-items-center">
<a href="swagger-ui.html">PowerAuth Third Party Provider Engine RESTful API</a>
<span class="badge badge-secondary badge-pill">Swagger</span>
</li>
</ul>
</div>
</div>
<div class="col-sm-5">
<div class="card mb-3">
<h5 class="card-header">Quick Links</h5>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a target="_blank" href="https://developers.wultra.com/components">Technical Documentation of Wultra Components</a></li>
<li class="list-group-item"><a target="_blank" href="https://github.com/wultra/powerauth-webflow">GitHub Develop Repository</a></li>
<li class="list-group-item"><a target="_blank" href="https://github.com/wultra/powerauth-webflow/issues">Report Issue</a></li>
</ul>
</div>
<div class="card mb-3">
<h5 class="card-header">Contact Us</h5>
<ul class="list-group list-group-flush">
<li class="list-group-item"><a target="_blank" href="https://wultra.com">🔗 Website</a></li>
<li class="list-group-item"><a target="_blank" href="https://wultra.com/discord">💬 Discord Chat</a></li>
<li class="list-group-item"><a href="mailto:[email protected]">✉️ E-mail</a></li>
</ul>
</div>
</div>
</div>
</div>
<footer class="container mt-3">
<p>&copy; <span th:text="${#dates.year(#dates.createNow())}">2020</span> <a target="_blank" href="https://wultra.com">Wultra s.r.o.</a></p>
</footer>
</body>
</html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 58acf77

Please sign in to comment.