Skip to content

Commit 7963027

Browse files
committed
Iniital commit.
0 parents  commit 7963027

File tree

89 files changed

+5090
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+5090
-0
lines changed

.gitignore

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
2+
# Created by https://www.gitignore.io/api/java,gradle,eclipse
3+
# Edit at https://www.gitignore.io/?templates=java,gradle,eclipse
4+
5+
### Eclipse ###
6+
.metadata
7+
bin/
8+
tmp/
9+
*.tmp
10+
*.bak
11+
*.swp
12+
*~.nib
13+
local.properties
14+
.settings/
15+
.loadpath
16+
.recommenders
17+
18+
# External tool builders
19+
.externalToolBuilders/
20+
21+
# Locally stored "Eclipse launch configurations"
22+
*.launch
23+
24+
# PyDev specific (Python IDE for Eclipse)
25+
*.pydevproject
26+
27+
# CDT-specific (C/C++ Development Tooling)
28+
.cproject
29+
30+
# CDT- autotools
31+
.autotools
32+
33+
# Java annotation processor (APT)
34+
.factorypath
35+
36+
# PDT-specific (PHP Development Tools)
37+
.buildpath
38+
39+
# sbteclipse plugin
40+
.target
41+
42+
# Tern plugin
43+
.tern-project
44+
45+
# TeXlipse plugin
46+
.texlipse
47+
48+
# STS (Spring Tool Suite)
49+
.springBeans
50+
51+
# Code Recommenders
52+
.recommenders/
53+
54+
# Annotation Processing
55+
.apt_generated/
56+
57+
# Scala IDE specific (Scala & Java development for Eclipse)
58+
.cache-main
59+
.scala_dependencies
60+
.worksheet
61+
62+
### Eclipse Patch ###
63+
# Eclipse Core
64+
.project
65+
66+
# JDT-specific (Eclipse Java Development Tools)
67+
.classpath
68+
69+
# Annotation Processing
70+
.apt_generated
71+
72+
.sts4-cache/
73+
74+
### Java ###
75+
# Compiled class file
76+
*.class
77+
78+
# Log file
79+
*.log
80+
*.log.*.gz
81+
82+
# BlueJ files
83+
*.ctxt
84+
85+
# Mobile Tools for Java (J2ME)
86+
.mtj.tmp/
87+
88+
# Package Files #
89+
*.jar
90+
*.war
91+
*.nar
92+
*.ear
93+
*.zip
94+
*.tar.gz
95+
*.rar
96+
97+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
98+
hs_err_pid*
99+
100+
### Gradle ###
101+
.gradle
102+
build/
103+
104+
# Ignore Gradle GUI config
105+
gradle-app.setting
106+
107+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
108+
!gradle-wrapper.jar
109+
110+
# Cache of project
111+
.gradletasknamecache
112+
113+
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
114+
# gradle/wrapper/gradle-wrapper.properties
115+
116+
### Gradle Patch ###
117+
**/build/
118+
119+
# End of https://www.gitignore.io/api/java,gradle,eclipse
120+
121+
122+
/config/*
123+
!/config/README.md
124+
!/config/*.example
125+
126+

HELP.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Getting Started
2+
3+
### Reference Documentation
4+
For further reference, please consider the following sections:
5+
6+
* [Official Gradle documentation](https://docs.gradle.org)
7+
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.2/gradle-plugin/reference/html/)
8+
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.2/gradle-plugin/reference/html/#build-image)
9+
* [Spring Boot DevTools](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#using-boot-devtools)
10+
* [Spring Configuration Processor](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#configuration-metadata-annotation-processor)
11+
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-developing-web-applications)
12+
* [Thymeleaf](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-spring-mvc-template-engines)
13+
* [Spring Security](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-security)
14+
* [JDBC API](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-sql)
15+
* [Spring Data JPA](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-jpa-and-spring-data)
16+
* [Java Mail Sender](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#boot-features-email)
17+
* [Spring Boot Actuator](https://docs.spring.io/spring-boot/docs/2.4.2/reference/htmlsingle/#production-ready)
18+
* [New Relic](https://docs.spring.io/spring-boot/docs/2.4.2/reference/html/production-ready-features.html#production-ready-metrics-export-new-relic)
19+
20+
### Guides
21+
The following guides illustrate how to use some features concretely:
22+
23+
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
24+
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
25+
* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/)
26+
* [Handling Form Submission](https://spring.io/guides/gs/handling-form-submission/)
27+
* [Securing a Web Application](https://spring.io/guides/gs/securing-web/)
28+
* [Spring Boot and OAuth2](https://spring.io/guides/tutorials/spring-boot-oauth2/)
29+
* [Authenticating a User with LDAP](https://spring.io/guides/gs/authenticating-ldap/)
30+
* [Accessing Relational Data using JDBC with Spring](https://spring.io/guides/gs/relational-data-access/)
31+
* [Managing Transactions](https://spring.io/guides/gs/managing-transactions/)
32+
* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
33+
* [Building a RESTful Web Service with Spring Boot Actuator](https://spring.io/guides/gs/actuator-service/)
34+
35+
### Additional Links
36+
These additional references should also help you:
37+
38+
* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle)
39+

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# SpringUserFramework
2+
A Easy to leverage User Management Framework based on Spring Security
3+
4+
## Summary
5+
This is an easy to use starter application or framework for handling basic user management features for your Spring based Web Application. It provides registration, with optional email verification, login, logout, and forgot password flows. There are basic example pages for everything, unstyled, to allow for the easiest integration to your application.
6+
7+
## Goals
8+
- To build an easy to use starting point for any Spring based web application that needs user features.
9+
- To provide a local database backed user store (although SSO integrations are easy to add using Spring Security).
10+
- To design based on REST APIs
11+
- To build on top of Spring Security to provide the best security and make it easy to leverage Spring Security features such as 2FA and SSO integrations.
12+
- To make it easily configurable using applicaiton.properties when possible
13+
- To use the messages feature for all user facing text and messaging, so internationalization is straight forward.
14+
- To provide an audit event framework to make security audit trails easy to deliver.
15+
- To use email address as the username by default.
16+
17+
## Features
18+
At the highest level the framework provides support for, and working examples of, registration, with or without email verification, log in, log out, and forgot password flows.
19+
20+
It uses a database for the user store, and leverages Spring JPA to make it easy to use any database you like.
21+
22+
Via simple configuration you can setup Spring Security to either block anonymous access to pages, excepting a whitelist of URIs (the most secure configuration) or to allow access by default, and configure a list of URIs to protect and require a logged in user session to access.
23+
24+
CSRF is enabled by default and the example jQuery AJAX calls pass the CSRF token from the Thymeleaf page context.
25+
26+
27+
## Notes
28+
Much of this is based on the [Baeldung course on Spring Security]( https://www.baeldung.com/learn-spring-security-course). If you want to learn more about Spring Security or you'd like to add an SSO integration or add 2FA, that guide is a great place to get started!
29+
30+
There is no warranty or garantee of functionaltiy, quality, performance, or security made by the author. This code is availble freely but you take all responsibilty and liabilty for your application.

build.gradle

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
plugins {
2+
id 'org.springframework.boot' version '2.4.2'
3+
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
4+
id 'java'
5+
id 'eclipse'
6+
}
7+
8+
group = 'com.digitalsanctuary.spring'
9+
version = '1.0.0-SNAPSHOT'
10+
sourceCompatibility = '11'
11+
12+
configurations {
13+
dev
14+
runtimeClasspath {
15+
extendsFrom developmentOnly
16+
}
17+
compileOnly {
18+
extendsFrom annotationProcessor
19+
}
20+
}
21+
22+
repositories {
23+
mavenCentral()
24+
}
25+
26+
dependencies {
27+
implementation 'org.springframework.boot:spring-boot-starter-actuator'
28+
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
29+
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
30+
implementation 'org.springframework.boot:spring-boot-starter-mail'
31+
implementation 'org.springframework.boot:spring-boot-starter-security'
32+
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
33+
implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'
34+
implementation 'org.springframework.boot:spring-boot-starter-web'
35+
implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'
36+
implementation 'com.newrelic.telemetry:micrometer-registry-new-relic:0.6.0'
37+
implementation 'org.passay:passay:1.6.0'
38+
compileOnly 'org.projectlombok:lombok'
39+
implementation 'com.google.guava:guava:30.1-jre'
40+
compileOnly 'javax.validation:validation-api:2.0.1.Final'
41+
developmentOnly 'org.springframework.boot:spring-boot-devtools'
42+
runtimeOnly 'org.mariadb.jdbc:mariadb-java-client'
43+
runtimeOnly 'org.postgresql:postgresql'
44+
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
45+
annotationProcessor 'org.projectlombok:lombok'
46+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
47+
testImplementation 'org.springframework.security:spring-security-test'
48+
testImplementation 'com.h2database:h2'
49+
}
50+
51+
test {
52+
useJUnitPlatform()
53+
}
54+
55+
configurations {
56+
dev
57+
}
58+
59+
bootJar {
60+
launchScript {
61+
properties 'confFolder': '/opt/app/conf/'
62+
}
63+
}
64+
65+
bootRun {
66+
// Use Spring Boot DevTool only when we run Gradle bootRun task
67+
classpath = sourceSets.main.runtimeClasspath + configurations.dev
68+
69+
if (project.hasProperty('profiles')) {
70+
environment SPRING_PROFILES_ACTIVE: profiles
71+
} else {
72+
def profiles = 'local'
73+
environment SPRING_PROFILES_ACTIVE: profiles
74+
}
75+
}

config/README.md

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
spring.mail.host=email-smtp.us-west-2.amazonaws.com
2+
spring.mail.username=your_aws_smtp_username
3+
spring.mail.password=your_aws_smtp_password
4+
5+
management.metrics.export.newrelic.apiKey=new_relic_api_key
6+
management.metrics.export.newrelic.accountId=new_relic_account_number
7+

gradle/wrapper/gradle-wrapper.jar

57.8 KB
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)