-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDK-3864] - Add support for client credential management (#525)
- Loading branch information
1 parent
b11a955
commit aba2257
Showing
12 changed files
with
662 additions
and
2 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
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
28 changes: 28 additions & 0 deletions
28
src/main/java/com/auth0/json/mgmt/client/ClientAuthenticationMethods.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,28 @@ | ||
package com.auth0.json.mgmt.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** | ||
* Class that represents an Auth0 Application authentication methods. Related to the {@link com.auth0.client.mgmt.ClientsEntity} entity. | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ClientAuthenticationMethods { | ||
|
||
@JsonProperty("private_key_jwt") | ||
private PrivateKeyJwt privateKeyJwt; | ||
|
||
public ClientAuthenticationMethods() { | ||
|
||
} | ||
|
||
public ClientAuthenticationMethods(PrivateKeyJwt privateKeyJwt) { | ||
this.privateKeyJwt = privateKeyJwt; | ||
} | ||
|
||
public PrivateKeyJwt getPrivateKeyJwt() { | ||
return privateKeyJwt; | ||
} | ||
} |
191 changes: 191 additions & 0 deletions
191
src/main/java/com/auth0/json/mgmt/client/Credential.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,191 @@ | ||
package com.auth0.json.mgmt.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Class that represents an Auth0 application credential object. Related to the {@link com.auth0.client.mgmt.ClientsEntity} entity. | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class Credential { | ||
|
||
@JsonProperty("credential_type") | ||
private String credentialType; | ||
@JsonProperty("name") | ||
private String name; | ||
@JsonProperty("pem") | ||
private String pem; | ||
|
||
@JsonProperty("id") | ||
private String id; | ||
@JsonProperty("kid") | ||
private String kid; | ||
@JsonProperty("thumbprint") | ||
private String thumbprint; | ||
@JsonProperty("alg") | ||
private String alg; | ||
@JsonProperty("parse_expiry_from_cert") | ||
private Boolean parseExpiryFromCert; | ||
@JsonFormat(shape = JsonFormat.Shape.STRING) | ||
@JsonProperty("created_at") | ||
private Date createdAt; | ||
@JsonFormat(shape = JsonFormat.Shape.STRING) | ||
@JsonProperty("updated_at") | ||
private Date updatedAt; | ||
@JsonFormat(shape = JsonFormat.Shape.STRING) | ||
@JsonProperty("expires_at") | ||
private Date expiresAt; | ||
|
||
/** | ||
* Create a new credential | ||
* @param credentialType the credential type | ||
* @param pem the PEM | ||
*/ | ||
public Credential(String credentialType, String pem) { | ||
this.credentialType = credentialType; | ||
this.pem = pem; | ||
} | ||
|
||
/** | ||
* Create a new credential | ||
* @param id the ID of the credential | ||
*/ | ||
public Credential(String id) { | ||
this.id = id; | ||
} | ||
|
||
/** | ||
* Create a new credential | ||
*/ | ||
public Credential() {} | ||
|
||
/** | ||
* @return the credential type | ||
*/ | ||
public String getCredentialType() { | ||
return credentialType; | ||
} | ||
|
||
/** | ||
* Sets the credential type | ||
* @param credentialType the credential type | ||
*/ | ||
public void setCredentialType(String credentialType) { | ||
this.credentialType = credentialType; | ||
} | ||
|
||
/** | ||
* @return the credential name | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* Sets the credential name | ||
* @param name the name of the credential | ||
*/ | ||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
/** | ||
* @return the credential's PEM | ||
*/ | ||
public String getPem() { | ||
return pem; | ||
} | ||
|
||
/** | ||
* Sets the credential's PEM | ||
* @param pem the PEM of the credential | ||
*/ | ||
public void setPem(String pem) { | ||
this.pem = pem; | ||
} | ||
|
||
/** | ||
* @return the ID of the credential | ||
*/ | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* @return the KID of the credential | ||
*/ | ||
public String getKid() { | ||
return kid; | ||
} | ||
|
||
/** | ||
* @return the thumbprint of the credential | ||
*/ | ||
public String getThumbprint() { | ||
return thumbprint; | ||
} | ||
|
||
/** | ||
* @return the date the credential was created at | ||
*/ | ||
public Date getCreatedAt() { | ||
return createdAt; | ||
} | ||
|
||
/** | ||
* @return the algorithm of this credential | ||
*/ | ||
public String getAlg() { | ||
return alg; | ||
} | ||
|
||
/** | ||
* Set the algorithm | ||
* @param alg the algorithm | ||
*/ | ||
public void setAlg(String alg) { | ||
this.alg = alg; | ||
} | ||
|
||
/** | ||
* @return the time this credential was last updated | ||
*/ | ||
public Date getUpdatedAt() { | ||
return updatedAt; | ||
} | ||
|
||
/** | ||
* @return the expiration time of this credential | ||
*/ | ||
public Date getExpiresAt() { | ||
return expiresAt; | ||
} | ||
|
||
/** | ||
* Set the expires_at value for this credential | ||
* @param expiresAt the time this credential should expire | ||
*/ | ||
public void setExpiresAt(Date expiresAt) { | ||
this.expiresAt = expiresAt; | ||
} | ||
|
||
/** | ||
* @return whether the expiry will be parsed from the x509 certificate | ||
*/ | ||
public Boolean getParseExpiryFromCert() { | ||
return parseExpiryFromCert; | ||
} | ||
|
||
/** | ||
* Whether to parse expiry from x509 certificate | ||
* @param parseExpiryFromCert true to parse expiry; false otherwise. | ||
*/ | ||
public void setParseExpiryFromCert(Boolean parseExpiryFromCert) { | ||
this.parseExpiryFromCert = parseExpiryFromCert; | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/com/auth0/json/mgmt/client/PrivateKeyJwt.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,38 @@ | ||
package com.auth0.json.mgmt.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Class that represents an Auth0 Application private key JWT authentication method. Related to the {@link com.auth0.client.mgmt.ClientsEntity} entity. | ||
*/ | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class PrivateKeyJwt { | ||
|
||
@JsonProperty("credentials") | ||
private List<Credential> credentials; | ||
|
||
/** | ||
* Create a new instance | ||
*/ | ||
public PrivateKeyJwt() {} | ||
|
||
/** | ||
* Create a new instance | ||
* @param credentials the credentials to use | ||
*/ | ||
public PrivateKeyJwt(List<Credential> credentials) { | ||
this.credentials = credentials; | ||
} | ||
|
||
/** | ||
* @return the credentials | ||
*/ | ||
public List<Credential> getCredentials() { | ||
return credentials; | ||
} | ||
} |
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
Oops, something went wrong.