forked from eclipse-tractusx/managed-identity-wallet
-
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.
feat: add dto objects for sts infrastructure
- Loading branch information
1 parent
effb480
commit 103e7f2
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
86 changes: 86 additions & 0 deletions
86
src/main/java/org/eclipse/tractusx/managedidentitywallets/dto/SecureTokenRequest.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,86 @@ | ||
/* | ||
* ******************************************************************************* | ||
* Copyright (c) 2021,2024 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* ****************************************************************************** | ||
*/ | ||
|
||
package org.eclipse.tractusx.managedidentitywallets.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
@Getter | ||
@Setter | ||
public class SecureTokenRequest { | ||
@NotBlank | ||
private String audience; | ||
|
||
@NotBlank | ||
@NotNull | ||
@JsonProperty("client_id") | ||
private String clientId; | ||
|
||
@NotBlank | ||
@NotNull | ||
@JsonProperty("client_secret") | ||
private String clientSecret; | ||
|
||
@NotBlank | ||
@NotNull | ||
@JsonProperty("grant_type") | ||
private String grantType; | ||
|
||
@JsonProperty("access_token") | ||
private String accessToken; | ||
|
||
@JsonProperty("bearer_access_alias") | ||
private String bearerAccessAlias; | ||
|
||
@JsonProperty("bearer_access_scope") | ||
private String bearerAccessScope; | ||
|
||
public boolean assertValidWithScopes() { | ||
return bearerAccessScope != null && accessToken == null && !bearerAccessScope.isEmpty(); | ||
} | ||
|
||
public boolean assertValidWithAccessToken() { | ||
return accessToken != null && bearerAccessScope == null; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "SecureTokenRequest{" + | ||
"audience='" + audience + '\'' + | ||
", clientId='" + clientId + '\'' + | ||
", clientSecret='" + clientSecret + '\'' + | ||
", grantType='" + grantType + '\'' + | ||
", accessToken='" + accessToken + '\'' + | ||
", bearerAccessAlias='" + bearerAccessAlias + '\'' + | ||
", bearerAccessScope='" + bearerAccessScope + '\'' + | ||
'}'; | ||
} | ||
} |