Skip to content

Commit 9d8fb4d

Browse files
OnBehalfOf claims
Signed-off-by: Stephen Crawford <[email protected]>
1 parent 8cc86ee commit 9d8fb4d

File tree

2 files changed

+8
-47
lines changed

2 files changed

+8
-47
lines changed

server/src/main/java/org/opensearch/identity/tokens/AuthToken.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
public interface AuthToken {
1717

1818
String asAuthHeaderValue();
19+
1920
}

server/src/main/java/org/opensearch/identity/tokens/OnBehalfOfClaims.java

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,17 @@
1414
public class OnBehalfOfClaims {
1515

1616
private final String audience;
17-
private final String subject;
18-
private final Long expiration;
19-
private final Long not_before;
20-
private final Long issued_at;
17+
private final Long expiration_seconds;
2118

2219
/**
2320
* Constructor for OnBehalfOfClaims
2421
* @param aud the Audience for the token
25-
* @param subject the subject of the token
26-
* @param expiration the length of time in seconds the token is valid
27-
* @param not_before the not_before time in seconds for the token
28-
* @param issued_at the issued_at time in seconds for the token
29-
*/
30-
public OnBehalfOfClaims(String aud, String subject, Long expiration, Long not_before, Long issued_at) {
31-
this.audience = aud;
32-
this.subject = subject;
33-
this.expiration = expiration;
34-
this.not_before = not_before;
35-
this.issued_at = issued_at;
36-
}
22+
* @param expiration_seconds the length of time in seconds the token is valid
3723
38-
/**
39-
* A constructor that sets a default issued at time of the current time
40-
* @param aud the Audience for the token
41-
* @param subject the subject of the token
42-
* @param expiration the expiration time in seconds for the token
43-
* @param not_before the not_before time in seconds for the token
4424
*/
45-
public OnBehalfOfClaims(String aud, String subject, Long expiration, Long not_before) {
46-
this(aud, subject, expiration, not_before, System.currentTimeMillis() / 1000);
47-
}
48-
49-
/**
50-
* A constructor which sets a default not before time of the current time
51-
* @param aud the Audience for the token
52-
* @param subject the subject of the token
53-
* @param expiration the expiration time in seconds for the token
54-
*/
55-
public OnBehalfOfClaims(String aud, String subject, Long expiration) {
56-
this(aud, subject, expiration, System.currentTimeMillis() / 1000);
25+
public OnBehalfOfClaims(String aud, Long expiration_seconds) {
26+
this.audience = aud;
27+
this.expiration_seconds = expiration_seconds;
5728
}
5829

5930
/**
@@ -62,26 +33,15 @@ public OnBehalfOfClaims(String aud, String subject, Long expiration) {
6233
* @param subject the subject of the token
6334
*/
6435
public OnBehalfOfClaims(String aud, String subject) {
65-
this(aud, subject, 300L);
36+
this(aud, 300L);
6637
}
6738

6839
public String getAudience() {
6940
return audience;
7041
}
7142

72-
public String getSubject() {
73-
return subject;
74-
}
7543

7644
public Long getExpiration() {
77-
return expiration;
78-
}
79-
80-
public Long getNot_before() {
81-
return not_before;
82-
}
83-
84-
public Long getIssued_at() {
85-
return issued_at;
45+
return expiration_seconds;
8646
}
8747
}

0 commit comments

Comments
 (0)