-
Notifications
You must be signed in to change notification settings - Fork 44
adding code changes to TransientTokenUtility #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
karthikeyankumarskcet
wants to merge
7
commits into
CyberSource:master
Choose a base branch
from
karthikeyankumarskcet:transient_token
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
16b51ce
adding code changes to TransientTokenUtility
Karthikeyan043 532ede7
code changes
Karthikeyan043 2e9a213
code changes
Karthikeyan043 6c85eb9
transientToken/Ctx.java
Karthikeyan043 999654e
adding delimiter splitter
Karthikeyan043 6d1f2f5
code changes to move files from one section to other
Karthikeyan043 568e88a
adding new files
Karthikeyan043 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/utilities/flex/models/transientToken/Ctx.java
This file contains hidden or 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,34 @@ | ||
|
||
package utilities.flex.models.transientToken; | ||
|
||
import javax.annotation.Generated; | ||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
|
||
@Generated("jsonschema2pojo") | ||
public class Ctx { | ||
|
||
@SerializedName("data") | ||
@Expose | ||
private Data data; | ||
@SerializedName("type") | ||
@Expose | ||
private String type; | ||
|
||
public Data getData() { | ||
return data; | ||
} | ||
|
||
public void setData(Data data) { | ||
this.data = data; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public void setType(String type) { | ||
this.type = type; | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/utilities/flex/models/transientToken/Data.java
This file contains hidden or 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,35 @@ | ||
|
||
package utilities.flex.models.transientToken; | ||
|
||
import java.util.List; | ||
import javax.annotation.Generated; | ||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
|
||
@Generated("jsonschema2pojo") | ||
public class Data { | ||
|
||
@SerializedName("targetOrigins") | ||
@Expose | ||
private List<String> targetOrigins = null; | ||
@SerializedName("mfOrigin") | ||
@Expose | ||
private String mfOrigin; | ||
|
||
public List<String> getTargetOrigins() { | ||
return targetOrigins; | ||
} | ||
|
||
public void setTargetOrigins(List<String> targetOrigins) { | ||
this.targetOrigins = targetOrigins; | ||
} | ||
|
||
public String getMfOrigin() { | ||
return mfOrigin; | ||
} | ||
|
||
public void setMfOrigin(String mfOrigin) { | ||
this.mfOrigin = mfOrigin; | ||
} | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
src/main/java/utilities/flex/models/transientToken/Flx.java
This file contains hidden or 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,56 @@ | ||
|
||
package utilities.flex.models.transientToken; | ||
|
||
import javax.annotation.Generated; | ||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
|
||
@Generated("jsonschema2pojo") | ||
public class Flx { | ||
|
||
@SerializedName("path") | ||
@Expose | ||
private String path; | ||
@SerializedName("data") | ||
@Expose | ||
private String data; | ||
@SerializedName("origin") | ||
@Expose | ||
private String origin; | ||
@SerializedName("jwk") | ||
@Expose | ||
private Jwk jwk; | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
|
||
public void setPath(String path) { | ||
this.path = path; | ||
} | ||
|
||
public String getData() { | ||
return data; | ||
} | ||
|
||
public void setData(String data) { | ||
this.data = data; | ||
} | ||
|
||
public String getOrigin() { | ||
return origin; | ||
} | ||
|
||
public void setOrigin(String origin) { | ||
this.origin = origin; | ||
} | ||
|
||
public Jwk getJwk() { | ||
return jwk; | ||
} | ||
|
||
public void setJwk(Jwk jwk) { | ||
this.jwk = jwk; | ||
} | ||
|
||
} |
67 changes: 67 additions & 0 deletions
67
src/main/java/utilities/flex/models/transientToken/Jwk.java
This file contains hidden or 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,67 @@ | ||
|
||
package utilities.flex.models.transientToken; | ||
|
||
import javax.annotation.Generated; | ||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
|
||
@Generated("jsonschema2pojo") | ||
public class Jwk { | ||
|
||
@SerializedName("kty") | ||
@Expose | ||
private String kty; | ||
@SerializedName("e") | ||
@Expose | ||
private String e; | ||
@SerializedName("use") | ||
@Expose | ||
private String use; | ||
@SerializedName("n") | ||
@Expose | ||
private String n; | ||
@SerializedName("kid") | ||
@Expose | ||
private String kid; | ||
|
||
public String getKty() { | ||
return kty; | ||
} | ||
|
||
public void setKty(String kty) { | ||
this.kty = kty; | ||
} | ||
|
||
public String getE() { | ||
return e; | ||
} | ||
|
||
public void setE(String e) { | ||
this.e = e; | ||
} | ||
|
||
public String getUse() { | ||
return use; | ||
} | ||
|
||
public void setUse(String use) { | ||
this.use = use; | ||
} | ||
|
||
public String getN() { | ||
return n; | ||
} | ||
|
||
public void setN(String n) { | ||
this.n = n; | ||
} | ||
|
||
public String getKid() { | ||
return kid; | ||
} | ||
|
||
public void setKid(String kid) { | ||
this.kid = kid; | ||
} | ||
|
||
} |
79 changes: 79 additions & 0 deletions
79
src/main/java/utilities/flex/models/transientToken/JwtResponseModel.java
This file contains hidden or 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,79 @@ | ||
|
||
package utilities.flex.models.transientToken; | ||
|
||
import java.util.List; | ||
import javax.annotation.Generated; | ||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
|
||
@Generated("jsonschema2pojo") | ||
public class JwtResponseModel { | ||
|
||
@SerializedName("flx") | ||
@Expose | ||
private Flx flx; | ||
@SerializedName("ctx") | ||
@Expose | ||
private List<Ctx> ctx = null; | ||
@SerializedName("iss") | ||
@Expose | ||
private String iss; | ||
@SerializedName("exp") | ||
@Expose | ||
private Integer exp; | ||
@SerializedName("iat") | ||
@Expose | ||
private Integer iat; | ||
@SerializedName("jti") | ||
@Expose | ||
private String jti; | ||
|
||
public Flx getFlx() { | ||
return flx; | ||
} | ||
|
||
public void setFlx(Flx flx) { | ||
this.flx = flx; | ||
} | ||
|
||
public List<Ctx> getCtx() { | ||
return ctx; | ||
} | ||
|
||
public void setCtx(List<Ctx> ctx) { | ||
this.ctx = ctx; | ||
} | ||
|
||
public String getIss() { | ||
return iss; | ||
} | ||
|
||
public void setIss(String iss) { | ||
this.iss = iss; | ||
} | ||
|
||
public Integer getExp() { | ||
return exp; | ||
} | ||
|
||
public void setExp(Integer exp) { | ||
this.exp = exp; | ||
} | ||
|
||
public Integer getIat() { | ||
return iat; | ||
} | ||
|
||
public void setIat(Integer iat) { | ||
this.iat = iat; | ||
} | ||
|
||
public String getJti() { | ||
return jti; | ||
} | ||
|
||
public void setJti(String jti) { | ||
this.jti = jti; | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/utilities/flex/models/transientToken/TransientTokenUtility.java
This file contains hidden or 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,34 @@ | ||
package utilities.flex.models.transientToken; | ||
|
||
import java.util.Base64; | ||
|
||
import com.google.gson.Gson; | ||
|
||
public class TransientTokenUtility { | ||
|
||
/** | ||
* This is the method to extract transient token from given jwt token | ||
* @param jwt | ||
* @return | ||
*/ | ||
public JwtResponseModel extractTransientToken(String jwt) | ||
{ | ||
// split the jwt token into two parts | ||
// bearer and token part | ||
String splitContents[] = jwt.split(" "); | ||
if(splitContents.length > 1) | ||
{ | ||
// decode the base 64 encoded string | ||
String encodedString = splitContents[1]; | ||
byte[] decodedBytes = Base64.getDecoder().decode(encodedString); | ||
String decodedString = new String(decodedBytes); | ||
Gson gson=new Gson(); | ||
// Map decoded string to response model | ||
JwtResponseModel jwtResponseModel = gson.fromJson(decodedString,JwtResponseModel.class); | ||
// return JTI string | ||
return jwtResponseModel; | ||
} | ||
|
||
return null; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.