Skip to content

Commit

Permalink
Changing Postgres Env Variable Name
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Wiens committed Sep 17, 2024
1 parent 0330f73 commit 08f0d62
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,18 @@ public DecodedMessage decode(EncodedMessage message) {
// build output data structure
return new MapDecodedMessage(processedMap, map, message.getAsn1Message(), "");
}catch (Exception e) {
System.out.println("XML Exception");
return new MapDecodedMessage(null, map, message.getAsn1Message(), e.getMessage());
}



} catch (JsonProcessingException e) {
System.out.println("JSON Processing Exception");
e.printStackTrace();
return new MapDecodedMessage(null, null, message.getAsn1Message(), e.getMessage());
} catch (Exception e) {
System.out.println("Generic Exception");
e.printStackTrace();
return new MapDecodedMessage(null, null, message.getAsn1Message(), e.getMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,15 @@ public boolean beforeHandshake(ServerHttpRequest req, ServerHttpResponse resp, W

try {

for(String key: atts.keySet()){
System.out.println("Attribute Key" + key);
}

System.out.println("JwtDecoder" + jwtDecoder);
System.out.println("DefaultTokenValidator" + defaultTokenValidator);

String token = getToken(req);
System.out.println("Token: " + token);

var decodedToken = jwtDecoder.decode(token);
OAuth2TokenValidatorResult result = defaultTokenValidator.validate(decodedToken);
if (result.hasErrors()) {
resp.setStatusCode(HttpStatus.FORBIDDEN);
System.out.println("Token is not valid:");
for (var tokenError : result.getErrors()) {
System.out.printf("Oauth2Error: %s%n", tokenError);
}
return false;
}
resp.setStatusCode(HttpStatus.SWITCHING_PROTOCOLS);
System.out.println("token valid");
} catch (Exception e) {
resp.setStatusCode(HttpStatus.UNAUTHORIZED);
return false;
Expand All @@ -65,14 +52,6 @@ public String getToken(ServerHttpRequest req){

HttpHeaders headers = req.getHeaders();
if( headers != null){

// for(String header: headers.keySet()){
// System.out.println(header);
// for(String value: headers.get(header)){
// System.out.println(" "+ value);
// }
// }


if(headers.containsKey("Token")){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ mongoTimeoutMs = ${CM_MONGO_TIMEOUT_MS:5000}

#Postgres Configuration
spring.datasource.url=${POSTGRES_SERVER_URL:jdbc:postgresql://localhost:5432}/postgres
spring.datasource.username=${PG_DB_USER:postgres}
spring.datasource.username=${PG_DB_USER:admin}
spring.datasource.password=${PG_DB_PASS:admin}
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto = update


cmServerURL = ${CM_SERVER_URL:http://localhost:8082}
Expand Down

0 comments on commit 08f0d62

Please sign in to comment.