Skip to content
Open
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
Binary file added Backend/Post-Service/uploads/1734444212781.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734444212808.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734444212816.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734457556285.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734457556325.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734457556334.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734458852692.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734458852698.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552233682.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552233726.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552233732.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552233745.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552233859.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552233919.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552234222.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552234255.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552465949.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552465970.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552465974.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552465981.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552466016.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Backend/Post-Service/uploads/1734552466032.jpeg
Binary file added Backend/Post-Service/uploads/1734552665937.jpeg
Binary file added Backend/Post-Service/uploads/1734552665953.jpeg
Binary file added Backend/Post-Service/uploads/1734552665956.jpeg
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public WebSocketEventListener(SimpMessageSendingOperations messagingTemplate) {
public void handleWebSocketDisconnectListener(SessionDisconnectEvent event) {
StompHeaderAccessor headerAccessor = StompHeaderAccessor.wrap(event.getMessage());

Long username = (Long) headerAccessor.getSessionAttributes().get("username");
String username = (String) headerAccessor.getSessionAttributes().get("username");
if (username != null) {
System.out.println("User disconnected: " + username);

ChatMessage chatMessage = new ChatMessage.Builder()
.sender(username)
.receiver(1L)
.receiver(username)
.content("User has left the chat")
.timestamp(String.valueOf(System.currentTimeMillis()))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ public class ChatMessage {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private Long sender;
private Long receiver;
private String sender;
private String receiver;
private String content;
private String timestamp;

public ChatMessage() {}

public ChatMessage(Long sender, Long receiver, String content, String timestamp) {
public ChatMessage(String sender, String receiver, String content, String timestamp) {
this.sender = sender;
this.receiver = receiver;
this.content = content;
Expand All @@ -40,19 +40,19 @@ public void setId(Long id) {
this.id = id;
}

public Long getSender() {
public String getSender() {
return sender;
}

public void setSender(Long sender) {
public void setSender(String sender) {
this.sender = sender;
}

public Long getReceiver() {
public String getReceiver() {
return receiver;
}

public void setReceiver(Long receiver) {
public void setReceiver(String receiver) {
this.receiver = receiver;
}

Expand All @@ -78,17 +78,17 @@ protected void onCreate() {

// Builder Pattern
public static class Builder {
private Long sender;
private Long receiver;
private String sender;
private String receiver;
private String content;
private String timestamp;

public Builder sender(Long sender) {
public Builder sender(String sender) {
this.sender = sender;
return this;
}

public Builder receiver(Long receiver) {
public Builder receiver(String receiver) {
this.receiver = receiver;
return this;
}
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class WebSecurityConfig {

public static final String ADMIN = "admin";
public static final String GENERAL = "general";
private final com.user.security.JwtAuthConverter jwtAuthConverter;
private final JwtAuthConverter jwtAuthConverter = new JwtAuthConverter();


@Bean
Expand Down Expand Up @@ -57,11 +57,13 @@ public WebSecurityCustomizer webSecurityCustomizer() {
);
web.ignoring().requestMatchers(
HttpMethod.DELETE,
"/public/**"
"/public/**",
"/users/**"
);
web.ignoring().requestMatchers(
HttpMethod.PUT,
"/public/**"
"/public/**",
"/users/**"
);
web.ignoring().requestMatchers(
HttpMethod.OPTIONS,
Expand Down
18 changes: 9 additions & 9 deletions Backend/service_users/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
management.endpoints.web.exposure.include=*

spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
spring.servlet.multipart.max-file-size=40MB
spring.servlet.multipart.max-request-size=40MB
server.tomcat.max-http-form-post-size=10485760
file.upload-dir=c:/uploads

keycloak.auth-server-url=http://localhost:8080/realms/FarmFinder
keycloak.auth-server-url=http://localhost:8050/realms/FarmFinder
keycloak.realm=FarmFinder
keycloak.resource=admin-cli
keycloak.public-client=true
keycloak.credentials.secret=EpFnfUvZr3uN9CUtw8wDxRWikJGJIGlM
keycloak.credentials.secret=5nnbmqITsz1CO1Ey3xIeqxDyBPEvXqOy
keycloak.use-resource-role-mappings=true
keycloak.ssl-required=external
keycloak.bearer-only=true
Expand All @@ -28,16 +28,16 @@ keycloak.bearer-only=true

jwt.auth.converter.resource-id=authenticationClientId

keycloak.domain=localhost:8080
keycloak.domain=localhost:8050
keycloak.adminClientId=admin-cli
keycloak.adminClientSecret=EpFnfUvZr3uN9CUtw8wDxRWikJGJIGlM
keycloak.adminClientSecret=5nnbmqITsz1CO1Ey3xIeqxDyBPEvXqOy
keycloak.client=authenticationClientId
keycloak.urls.auth=http://${keycloak.domain}

spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8080/realms/FarmFinder
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8050/realms/FarmFinder

spring.security.oauth2.resourceserver.jwt.jwk-set-uri=${spring.security.oauth2.resourceserver.jwt.issuer-uri}/protocol/openid-connect/certs

spring.security.oauth2.client.registration.keycloak.client-id=admin-cli
spring.security.oauth2.client.registration.keycloak.client-secret=EpFnfUvZr3uN9CUtw8wDxRWikJGJIGlM
spring.security.oauth2.client.provider.keycloak.token-uri=http://localhost:8080/realms/FarmFinder/protocol/openid-connect/token
spring.security.oauth2.client.registration.keycloak.client-secret=5nnbmqITsz1CO1Ey3xIeqxDyBPEvXqOy
spring.security.oauth2.client.provider.keycloak.token-uri=http://localhost:8050/realms/FarmFinder/protocol/openid-connect/token
Loading