Skip to content

Commit

Permalink
scopes as list
Browse files Browse the repository at this point in the history
  • Loading branch information
sai-sunder-s committed Dec 12, 2022
1 parent ef9234c commit 0142ca5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions oauth2_http/java/com/google/auth/oauth2/AccessToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@

import com.google.common.base.MoreObjects;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;

/** Represents a temporary OAuth2 access token and its expiration information. */
Expand All @@ -43,7 +45,7 @@ public class AccessToken implements Serializable {

private final String tokenValue;
private final Long expirationTimeMillis;
private final String scopes;
private final List<String> scopes;

/**
* @param tokenValue String representation of the access token.
Expand Down Expand Up @@ -76,7 +78,7 @@ public Builder toBuilder() {
*
* @return Space seperated string of scopes
*/
public String getScopes() {
public List<String> getScopes() {
return scopes;
}

Expand Down Expand Up @@ -133,7 +135,7 @@ public boolean equals(Object obj) {
public static class Builder {
private String tokenValue;
private Date expirationTime;
private String scopes;
private List<String> scopes;

protected Builder() {}

Expand All @@ -147,7 +149,7 @@ public String getTokenValue() {
return this.tokenValue;
}

public String getScopes() {
public List<String> getScopes() {
return this.scopes;
}

Expand All @@ -161,7 +163,7 @@ public Builder setTokenValue(String tokenValue) {
}

public Builder setScopes(String scopes) {
this.scopes = scopes;
this.scopes = Arrays.asList(scopes.split(" "));
return this;
}

Expand Down

0 comments on commit 0142ca5

Please sign in to comment.