Skip to content

Commit

Permalink
OnBehalfOf claims
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Crawford <steecraw@amazon.com>
  • Loading branch information
stephen-crawford committed Oct 17, 2023
1 parent ca57018 commit 9c58d6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
public interface AuthToken {

String asAuthHeaderValue();

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,46 +14,17 @@
public class OnBehalfOfClaims {

private final String audience;
private final String subject;
private final Long expiration;
private final Long not_before;
private final Long issued_at;
private final Long expiration_seconds;

/**
* Constructor for OnBehalfOfClaims
* @param aud the Audience for the token
* @param subject the subject of the token
* @param expiration the length of time in seconds the token is valid
* @param not_before the not_before time in seconds for the token
* @param issued_at the issued_at time in seconds for the token
*/
public OnBehalfOfClaims(String aud, String subject, Long expiration, Long not_before, Long issued_at) {
this.audience = aud;
this.subject = subject;
this.expiration = expiration;
this.not_before = not_before;
this.issued_at = issued_at;
}
* @param expiration_seconds the length of time in seconds the token is valid
/**
* A constructor that sets a default issued at time of the current time
* @param aud the Audience for the token
* @param subject the subject of the token
* @param expiration the expiration time in seconds for the token
* @param not_before the not_before time in seconds for the token
*/
public OnBehalfOfClaims(String aud, String subject, Long expiration, Long not_before) {
this(aud, subject, expiration, not_before, System.currentTimeMillis() / 1000);
}

/**
* A constructor which sets a default not before time of the current time
* @param aud the Audience for the token
* @param subject the subject of the token
* @param expiration the expiration time in seconds for the token
*/
public OnBehalfOfClaims(String aud, String subject, Long expiration) {
this(aud, subject, expiration, System.currentTimeMillis() / 1000);
public OnBehalfOfClaims(String aud, Long expiration_seconds) {
this.audience = aud;
this.expiration_seconds = expiration_seconds;
}

/**
Expand All @@ -62,26 +33,15 @@ public OnBehalfOfClaims(String aud, String subject, Long expiration) {
* @param subject the subject of the token
*/
public OnBehalfOfClaims(String aud, String subject) {
this(aud, subject, 300L);
this(aud, 300L);
}

public String getAudience() {
return audience;
}

public String getSubject() {
return subject;
}

public Long getExpiration() {
return expiration;
}

public Long getNot_before() {
return not_before;
}

public Long getIssued_at() {
return issued_at;
return expiration_seconds;
}
}

0 comments on commit 9c58d6f

Please sign in to comment.