Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
tab_width = 2

[.gitignore]
max_line_length = unset

[*.md]
max_line_length = unset

[*.feature]
tab_width = 4

[*.gsp]
indent_size = 4
tab_width = 4

[*.haml]
tab_width = 4

[*.less]
tab_width = 4

[*.styl]
tab_width = 4

[.editorconfig]
max_line_length = unset

[{*.as,*.js2,*.es}]
indent_size = 4
tab_width = 4

[{*.cfml,*.cfm,*.cfc}]
indent_size = 4
tab_width = 4

[{*.cjs,*.js}]
max_line_length = 80

[{*.gradle,*.groovy,*.gant,*.gdsl,*.gy,*.gson}]
indent_size = 4
tab_width = 4

[{*.jspx,*.tagx}]
indent_size = 4
tab_width = 4

[{*.kts,*.kt}]
indent_size = 4
tab_width = 4

[{*.vsl,*.vm,*.ft}]
indent_size = 4
tab_width = 4

[{*.xjsp,*.tag,*.jsf,*.jsp,*.jspf,*.tagf}]
indent_size = 4
tab_width = 4

[{*.yml,*.yaml}]
tab_width = 4

22 changes: 19 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
plugins {
id 'java'
id 'eclipse'
id 'org.springframework.boot' version '3.3.1'
id 'io.spring.dependency-management' version '1.1.5'
id 'com.diffplug.eclipse.apt' version '3.26.0'
id 'org.liquibase.gradle' version '3.0.1'
}

group = 'com.sms.stockmanagementsystem'
group = 'eu.goldenkoopa'

java {
toolchain {
Expand All @@ -24,17 +27,29 @@ repositories {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-validation:3.5.0'
testImplementation 'org.springframework.security:spring-security-test'

compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'

runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'org.jetbrains:annotations:15.0'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:3.3.1'
implementation 'org.hsqldb:hsqldb:2.7.1'
implementation 'me.paulschwarz:spring-dotenv:4.0.0'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'

// implementation 'org.liquibase:liquibase-core:4.32.0'
// runtimeOnly 'org.liquibase.ext:liquibase-hibernate6:4.32.0'

}

bootRun {
environment 'spring.output.ansi.console-available', true
}

tasks.register('buildDockerImage') {
Expand All @@ -60,3 +75,4 @@ tasks.register('buildDockerImage') {
tasks.named('test') {
useJUnitPlatform()
}

4 changes: 2 additions & 2 deletions dev/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ version: '3.9'

services:
postgres:
image: postgres:14-alpine
image: postgres:17-alpine
ports:
- 5432:5432
volumes:
- ~/apps/postgres:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_DB=${POSTGRES_DB}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = 'project'
rootProject.name = 'stockmanagementsystem'

This file was deleted.

25 changes: 0 additions & 25 deletions src/main/java/com/sms/stockmanagementsystem/project/Security.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package eu.goldenkoopa.stockmanagementsystem;

import eu.goldenkoopa.stockmanagementsystem.data.authentication.ApiKey;
import java.util.stream.Collectors;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.authority.AuthorityUtils;

/**
* ApiKeyAuthenticationToken
*/
public class ApiKeyAuthenticationToken extends AbstractAuthenticationToken {

private ApiKey apiKey;

public ApiKeyAuthenticationToken(ApiKey apiKey) {
super(AuthorityUtils.createAuthorityList(
apiKey.getPrivileges()
.stream()
.map(privilege -> privilege.getName())
.toList()));
this.apiKey = apiKey;
}

@Override
public Object getCredentials() {
return null;
}

@Override
public Object getPrincipal() {
return apiKey;
}

@Override
public boolean isAuthenticated() {
return true;
}

@Override
public void setAuthenticated(boolean authenticated) {
throw new RuntimeException("cannot modify");
}
}
Loading