-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
model: add MFA requirement data to auth response
- Loading branch information
Showing
5 changed files
with
305 additions
and
23 deletions.
There are no files selected for viewing
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
62 changes: 62 additions & 0 deletions
62
src/main/java/de/stklcode/jvault/connector/model/response/embedded/MfaConstraintAny.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,62 @@ | ||
/* | ||
* Copyright 2016-2023 Stefan Kalscheuer | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://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. | ||
*/ | ||
|
||
package de.stklcode.jvault.connector.model.response.embedded; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Embedded multi-factor-authentication (MFA) constraint "any". | ||
* | ||
* @author Stefan Kalscheuer | ||
* @since 1.2 | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public final class MfaConstraintAny implements Serializable { | ||
private static final long serialVersionUID = 1226126781813149627L; | ||
|
||
@JsonProperty("any") | ||
private List<MfaMethodId> any; | ||
|
||
/** | ||
* @return List of "any" MFA methods | ||
*/ | ||
public List<MfaMethodId> getAny() { | ||
return any; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
MfaConstraintAny mfaRequirement = (MfaConstraintAny) o; | ||
return Objects.equals(any, mfaRequirement.any); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(any); | ||
} | ||
} |
94 changes: 94 additions & 0 deletions
94
src/main/java/de/stklcode/jvault/connector/model/response/embedded/MfaMethodId.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,94 @@ | ||
/* | ||
* Copyright 2016-2023 Stefan Kalscheuer | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://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. | ||
*/ | ||
|
||
package de.stklcode.jvault.connector.model.response.embedded; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.io.Serializable; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Embedded multi-factor-authentication (MFA) requirement. | ||
* | ||
* @author Stefan Kalscheuer | ||
* @since 1.2 | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public final class MfaMethodId implements Serializable { | ||
private static final long serialVersionUID = 691298070242998814L; | ||
|
||
@JsonProperty("type") | ||
private String type; | ||
|
||
@JsonProperty("id") | ||
private String id; | ||
|
||
@JsonProperty("uses_passcode") | ||
private Boolean usesPasscode; | ||
|
||
@JsonProperty("name") | ||
private String name; | ||
|
||
/** | ||
* @return MFA method type | ||
*/ | ||
public String getType() { | ||
return type; | ||
} | ||
|
||
/** | ||
* @return MFA method id | ||
*/ | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* @return MFA uses passcode id | ||
*/ | ||
public Boolean getUsesPasscode() { | ||
return usesPasscode; | ||
} | ||
|
||
/** | ||
* @return MFA method name | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
MfaMethodId mfaMethodId = (MfaMethodId) o; | ||
return Objects.equals(type, mfaMethodId.type) && | ||
Objects.equals(id, mfaMethodId.id) && | ||
Objects.equals(usesPasscode, mfaMethodId.usesPasscode) && | ||
Objects.equals(name, mfaMethodId.name); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(type, id, usesPasscode, name); | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/main/java/de/stklcode/jvault/connector/model/response/embedded/MfaRequirement.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,73 @@ | ||
/* | ||
* Copyright 2016-2023 Stefan Kalscheuer | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://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. | ||
*/ | ||
|
||
package de.stklcode.jvault.connector.model.response.embedded; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.io.Serializable; | ||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Embedded multi-factor-authentication (MFA) requirement. | ||
* | ||
* @author Stefan Kalscheuer | ||
* @since 1.2 | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public final class MfaRequirement implements Serializable { | ||
private static final long serialVersionUID = -2516941512455319638L; | ||
|
||
@JsonProperty("mfa_request_id") | ||
private String mfaRequestId; | ||
|
||
@JsonProperty("mfa_constraints") | ||
private Map<String, MfaConstraintAny> mfaConstraints; | ||
|
||
/** | ||
* @return MFA request ID | ||
*/ | ||
public String getMfaRequestId() { | ||
return mfaRequestId; | ||
} | ||
|
||
/** | ||
* @return MFA constraints | ||
*/ | ||
public Map<String, MfaConstraintAny> getMfaConstraints() { | ||
return mfaConstraints; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
MfaRequirement mfaRequirement = (MfaRequirement) o; | ||
return Objects.equals(mfaRequestId, mfaRequirement.mfaRequestId) && | ||
Objects.equals(mfaConstraints, mfaRequirement.mfaConstraints); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(mfaRequestId, mfaConstraints); | ||
} | ||
} |
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