-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into da_AJ-1011_noInstanceInGetJob
- Loading branch information
Showing
12 changed files
with
180 additions
and
63 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
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
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
52 changes: 52 additions & 0 deletions
52
service/src/main/java/org/databiosphere/workspacedataservice/shared/model/BearerToken.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,52 @@ | ||
package org.databiosphere.workspacedataservice.shared.model; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Record class to represent an auth token; use this instead of String for more type safety and | ||
* readability of argument lists. As of this writing, WDS includes both Nimbus and Apache Oltu as | ||
* transitive dependencies, and both of those libraries include models to represent a token; but | ||
* they also both have more complexity than we need, and we don't want to depend too much on | ||
* transitive dependencies | ||
*/ | ||
public class BearerToken { | ||
|
||
private final String value; | ||
|
||
private BearerToken(String value) { | ||
this.value = value; | ||
} | ||
|
||
/** returns an empty BearerToken; that is, a BearerToken whose `value` is null */ | ||
public static BearerToken empty() { | ||
return new BearerToken(null); | ||
} | ||
|
||
/** returns a BearerToken with the specified `value` */ | ||
public static BearerToken of(String val) { | ||
return new BearerToken(val); | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
/** indicates if this BearerToken is empty; that is, has a null `value` */ | ||
public boolean isEmpty() { | ||
return value == null; | ||
} | ||
|
||
/** indicates if this BearerToken is not empty; that is, has a non-null `value` */ | ||
public boolean nonEmpty() { | ||
return !isEmpty(); | ||
} | ||
|
||
// generated by IntelliJ | ||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
BearerToken that = (BearerToken) o; | ||
return Objects.equals(value, that.value); | ||
} | ||
} |
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
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.