-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...ound-backend/src/main/java/ch/sbb/playgroundbackend/controller/CustomClaimController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package ch.sbb.playgroundbackend.controller; | ||
|
||
import ch.sbb.playgroundbackend.model.azure.Action; | ||
import ch.sbb.playgroundbackend.model.azure.Claims; | ||
import ch.sbb.playgroundbackend.model.azure.TokenIssuanceStartRequest; | ||
import ch.sbb.playgroundbackend.model.azure.TokenIssuanceStartResponse; | ||
import ch.sbb.playgroundbackend.model.azure.TokenIssuanceStartResponseData; | ||
import ch.sbb.playgroundbackend.service.SferaHandler; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.util.List; | ||
|
||
@RestController | ||
@RequestMapping("customClaim") | ||
public class CustomClaimController { | ||
|
||
private static final Logger log = LoggerFactory.getLogger(CustomClaimController.class); | ||
|
||
public CustomClaimController() { | ||
|
||
} | ||
|
||
@PostMapping | ||
TokenIssuanceStartResponse tokenIssuanceStartEvent(@RequestBody TokenIssuanceStartRequest body) { | ||
log.info("Received request with body: {}", body); | ||
|
||
|
||
Claims claims = new Claims("1085", "719_2024-06-13", "active"); | ||
Action action = new Action("microsoft.graph.tokenIssuanceStart.provideClaimsForToken", claims); | ||
TokenIssuanceStartResponseData responseData = new TokenIssuanceStartResponseData("microsoft.graph.onTokenIssuanceStartResponseData", List.of(action)); | ||
TokenIssuanceStartResponse response = new TokenIssuanceStartResponse(responseData); | ||
log.info("Response: {}", response); | ||
return response; | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
playground-backend/src/main/java/ch/sbb/playgroundbackend/model/azure/Action.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public record Action(@JsonProperty("@odata.type") String type, Claims claims) { | ||
} |
4 changes: 4 additions & 0 deletions
4
...ound-backend/src/main/java/ch/sbb/playgroundbackend/model/azure/AuthenticationClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
public record AuthenticationClient(String ip, String locale, String market) { | ||
} |
6 changes: 6 additions & 0 deletions
6
...und-backend/src/main/java/ch/sbb/playgroundbackend/model/azure/AuthenticationContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
public record AuthenticationContext(String correlationId, AuthenticationClient client, String protocol, | ||
ServicePrinciple clientServicePrincipal, ServicePrinciple resourceServicePrincipal, | ||
AzureUser user) { | ||
} |
7 changes: 7 additions & 0 deletions
7
playground-backend/src/main/java/ch/sbb/playgroundbackend/model/azure/AzureUser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
public record AzureUser(String companyName, String createdDateTime, String displayName, String givenName, String id, | ||
String mail, String onPremisesSamAccountName, String onPremisesSecurityIdentifier, | ||
String onPremisesUserPrincipalName, String preferredLanguage, String surname, | ||
String userPrincipalName, String userType) { | ||
} |
8 changes: 8 additions & 0 deletions
8
playground-backend/src/main/java/ch/sbb/playgroundbackend/model/azure/Claims.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public record Claims(@JsonProperty("http://uic.org/90940/ru") String ru, | ||
@JsonProperty("http://uic.org/90940/train") String train, | ||
@JsonProperty("http://uic.org/90940/role") String role) { | ||
} |
4 changes: 4 additions & 0 deletions
4
playground-backend/src/main/java/ch/sbb/playgroundbackend/model/azure/ServicePrinciple.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
public record ServicePrinciple(String id, String appId, String appDisplayName, String displayName) { | ||
} |
4 changes: 4 additions & 0 deletions
4
...backend/src/main/java/ch/sbb/playgroundbackend/model/azure/TokenIssuanceStartRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
public record TokenIssuanceStartRequest(String type, String source, TokenIssuanceStartRequestData data) { | ||
} |
6 changes: 6 additions & 0 deletions
6
...end/src/main/java/ch/sbb/playgroundbackend/model/azure/TokenIssuanceStartRequestData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
public record TokenIssuanceStartRequestData(String tenantId, String authenticationEventListenerId, | ||
String customAuthenticationExtensionId, | ||
AuthenticationContext authenticationContext) { | ||
} |
4 changes: 4 additions & 0 deletions
4
...ackend/src/main/java/ch/sbb/playgroundbackend/model/azure/TokenIssuanceStartResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
public record TokenIssuanceStartResponse(TokenIssuanceStartResponseData data) { | ||
} |
8 changes: 8 additions & 0 deletions
8
...nd/src/main/java/ch/sbb/playgroundbackend/model/azure/TokenIssuanceStartResponseData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package ch.sbb.playgroundbackend.model.azure; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.List; | ||
|
||
public record TokenIssuanceStartResponseData(@JsonProperty("@odata.type") String type, List<Action> actions) { | ||
} |