Skip to content

Commit

Permalink
temp springboot
Browse files Browse the repository at this point in the history
  • Loading branch information
hazendaz committed Jan 21, 2024
1 parent 52972ec commit 0cef39e
Show file tree
Hide file tree
Showing 20 changed files with 822 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/JNA/waffle-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<module>waffle-mixed</module>
<module>waffle-mixed-post</module>
<module>waffle-negotiate</module>
<module>waffle-springboot</module>
<module>waffle-spring-filter</module>
<module>waffle-spring-form</module>
<module>waffle-spring-boot-filter2</module>
Expand Down Expand Up @@ -98,6 +99,11 @@
<artifactId>caffeine</artifactId>
<version>${caffeine.version}</version>
</dependency>
<dependency>
<groupId>com.github.waffle</groupId>
<artifactId>waffle-spring-security5</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
18 changes: 18 additions & 0 deletions Source/JNA/waffle-demo/waffle-springboot/compression.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Waffle (https://github.com/Waffle/waffle)
Copyright (c) 2010-2016 Application Security, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
Public License v1.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v10.html.
Contributors: Application Security, Inc.
-->
<!DOCTYPE Compression>
<Compression>
<!-- Dummy compression file -->
</Compression>
82 changes: 82 additions & 0 deletions Source/JNA/waffle-demo/waffle-springboot/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Waffle (https://github.com/Waffle/waffle)
Copyright (c) 2010-2016 Application Security, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
Public License v1.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v10.html.
Contributors: Application Security, Inc.
-->
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.github.waffle.demo</groupId>
<artifactId>waffle-demo-parent</artifactId>
<version>1.9.0-SNAPSHOT</version>
</parent>

<artifactId>waffle-springboot</artifactId>
<version>1.9.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>waffle-springboot</name>
<description>Springboot Demo for WAFFLE</description>
<url>https://waffle.github.com/waffle/</url>

<scm>
<connection>scm:git:ssh://[email protected]/Waffle/waffle.git</connection>
<developerConnection>scm:git:ssh://[email protected]/Waffle/waffle.git</developerConnection>
<url>https://github.com/Waffle/waffle</url>
<tag>HEAD</tag>
</scm>

<properties>
<springboot.version>1.5.7.RELEASE</springboot.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${springboot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.waffle</groupId>
<artifactId>waffle-spring-security4</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.waffle</groupId>
<artifactId>waffle-tomcat85</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<finalName>${project.name}</finalName>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
Waffle (https://github.com/Waffle/waffle)
Copyright (c) 2010-2016 Application Security, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
Public License v1.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v10.html.
Contributors: Application Security, Inc.
-->
<!DOCTYPE configuration>
<configuration scan="true" debug="false">
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${catalina.base}/logs/waffle-springboot.log</file>

<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>>${catalina.base}/logs/archive/waffle-springboot.%i.log.zip
</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>3</maxIndex>
</rollingPolicy>

<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>5MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n
</pattern>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="FILE" />
</root>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
Waffle (https://github.com/Waffle/waffle)
Copyright (c) 2010-2016 Application Security, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
Public License v1.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v10.html.
Contributors: Application Security, Inc.
-->
<html>
<head>
<title>Access Denied (Waffle)</title>
</head>
<body>
Access Denied
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
Waffle (https://github.com/Waffle/waffle)
Copyright (c) 2010-2016 Application Security, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
Public License v1.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v10.html.
Contributors: Application Security, Inc.
-->
<html>
<head>
<title>Page Not Found (Waffle)</title>
</head>
<body>
Page Not Found
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Waffle (https://github.com/Waffle/waffle)
Copyright (c) 2010-2016 Application Security, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
Public License v1.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v10.html.
Contributors: Application Security, Inc.
-->
<web-app xmlns="https://java.sun.com/xml/ns/javaee" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://java.sun.com/xml/ns/javaee https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<description>Waffle Springboot Authenticator Demo</description>
<display-name>Waffle Demo</display-name>

<security-constraint>
<display-name>Waffle Security Constraint</display-name>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Everyone</role-name>
</auth-constraint>
</security-constraint>
<security-role>
<role-name>Everyone</role-name>
</security-role>

<error-page>
<error-code>401</error-code>
<location>/401.html</location>
</error-page>

</web-app>
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<%--
Waffle (https://github.com/Waffle/waffle)
Copyright (c) 2010-2016 Application Security, Inc.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse
Public License v1.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v10.html.
Contributors: Application Security, Inc.
--%>
<%
if (request.getParameter("logoff") != null) {
session.invalidate();
response.sendRedirect("index.jsp");
return;
}
%>
<html>
<head>
<title>Protected Page for Examples</title>
</head>
<body style="background-color:white;">
You are logged in as remote user <b><%= request.getRemoteUser() %></b> in session <b><%= session.getId() %></b>.
<br><br>
<%
if (request.getUserPrincipal() != null) {
%>
Your user principal name is <b><%= request.getUserPrincipal().getName() %></b>.
<br><br>
<%
} else {
%>
No user principal could be identified.
<br><br>
<%
}
%>
<%
String role = request.getParameter("role");
if (role == null)
role = "";
if (role.length() > 0) {
if (request.isUserInRole(role)) {
%>
You have been granted role <b><%= role %></b>.
<br><br>
<%
} else {
%>
You have <i>not</i> been granted role <b><%= role %></b>.
<br><br>
<%
}
}
%>
To check whether your username has been granted a particular role, enter it here:
<form method="GET" action='<%= response.encodeURL("index.jsp") %>'>
<input type="text" name="role" value="<%= role %>">
</form>
<br><br>
You can logoff by clicking
<a href='<%= response.encodeURL("index.jsp?logoff=true") %>'>here</a>.
This should cause automatic re-logon with Waffle and a new session ID.
</body>
</html>
Loading

0 comments on commit 0cef39e

Please sign in to comment.