Skip to content

Commit a4678b4

Browse files
author
Joerg Huber
committed
Added main() for testing purposes.
1 parent 8969748 commit a4678b4

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

SIF3InfraREST/test/src/sif3/infra/test/common/security/BaseSecurityOperations.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class BaseSecurityOperations
4141
@SuppressWarnings("unused")
4242
public static TokenInfo createToken(TokenCoreInfo coreInfo, String password)
4343
{
44-
String iso8601Str = "2015-08-06T14:00:00Z";
44+
String iso8601Str = "2016-05-17T14:01:00Z";
4545
String token = coreInfo.getAppUserInfo().getApplicationKey()+":"+iso8601Str;
4646
token = new String(Base64.encodeBase64(token.getBytes()), Charset.forName("ASCII"));
4747
TokenInfo newToken = null;
@@ -74,7 +74,8 @@ public static TokenInfo getTokenInfo(String token)
7474
int pos = decodedToken.indexOf(":");
7575
String appKey = decodedToken.substring(0, pos);
7676
String expDate = decodedToken.substring(pos+1);
77-
newToken.setAppUserInfo(new EnvironmentKey(null, appKey));
77+
// newToken.setAppUserInfo(new EnvironmentKey(null, appKey));
78+
newToken.setAppUserInfo(new EnvironmentKey("test", appKey));
7879
try
7980
{
8081
newToken.setTokenExpiryDate(DateUtils.stringToDate(expDate, DateUtils.ISO_8601));
@@ -87,4 +88,14 @@ public static TokenInfo getTokenInfo(String token)
8788

8889
return newToken;
8990
}
91+
92+
public static void main(String[] args)
93+
{
94+
TokenCoreInfo coreInfo = new TokenCoreInfo();
95+
coreInfo.setAppUserInfo(new EnvironmentKey(null, "BearerTest"));
96+
TokenInfo tokenInfo = createToken(coreInfo, "test");
97+
System.out.println("Created Token: "+tokenInfo);
98+
99+
System.out.println("Extracted token info: "+getTokenInfo(tokenInfo.getToken()));
100+
}
90101
}

0 commit comments

Comments
 (0)