Skip to content

Commit

Permalink
[Gepardec/mega#735] temp commit authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
Ollitod committed Sep 24, 2024
1 parent 37b5883 commit 27a1a75
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/gepardec/mega/rest/impl/MailResourceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import com.gepardec.mega.notification.mail.ReminderEmailSender;
import com.gepardec.mega.notification.mail.receiver.MailReceiver;
import com.gepardec.mega.rest.api.MailResource;
import io.quarkus.oidc.Tenant;
import io.quarkus.security.Authenticated;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.HttpHeaders;
Expand Down Expand Up @@ -74,15 +76,17 @@ public LocalDateTime ping() {
@Claim(standard = Claims.email)
ClaimValue<String> email;

@Tenant("pubsub")
@Authenticated
@Override
public LocalDateTime postPing(HttpHeaders httpHeaders) {
logger.info("Received POST request");
logger.info("Headers: {}", httpHeaders.getRequestHeaders());
logger.info("Email: {}", email.getValue());

if (!"gepardec-service-mail@mega-260510.iam.gserviceaccount.com".equals(email.getValue())) {
throw new UnauthorizedException("Account not authorized to access this resource.");
}
// if (!"gepardec-service-mail@mega-260510.iam.gserviceaccount.com".equals(email.getValue())) {
// throw new UnauthorizedException("Account not authorized to access this resource.");
// }

return LocalDateTime.now();
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ quarkus:
roles:
source: accesstoken
role-claim-path: "resource_access/mega-cron/roles"
google:
auth-server-url: "https://accounts.google.com"
application-type: "service"
token:
issuer: "https://accounts.google.com"
pubsub:
provider: google




mp:
openapi:
Expand Down

0 comments on commit 27a1a75

Please sign in to comment.