-
Notifications
You must be signed in to change notification settings - Fork 17
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
Final Refactoring - Syw UID2-4158 token gen code refactoring user identity #1123
base: main
Are you sure you want to change the base?
Changes from all commits
1693ea8
14fd733
7dd3a69
f2e7a87
c0cb6df
0fccf8c
113e8ca
ae03ff5
5595a15
c6bc08f
639b799
d9c730e
42c5890
b62aa54
b272d40
7e5ad5d
131d203
8dc0a41
91ffa12
d9845b7
4bb4ccb
8ae5e08
5a0bb89
b507d8e
f5877b7
ccc639f
dabff48
d8eda03
e74e8da
7f4ebf5
72f7be4
44ed5d3
21f0c60
6031d14
3b1718c
0ab0a79
7538bfb
249c25d
53f4de1
3624f15
a38af09
4c1de75
062f908
76a1345
5db6e4f
741237d
3900017
e5b104d
e25cd19
986cf2e
f445180
e4e7d2d
fa1c0f1
20d695c
c950c6d
a908e1f
04dfc14
2edcb05
ca44945
da549b0
c6586a5
d76bceb
23a6f50
a002ad1
ea0b247
4476ee1
6bb1fb9
a8f0915
7875d98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.uid2.operator.model; | ||
|
||
import java.time.Instant; | ||
|
||
import com.uid2.operator.model.identities.RawUid; | ||
import com.uid2.operator.util.PrivacyBits; | ||
import com.uid2.shared.model.TokenVersion; | ||
|
||
// class containing enough information to create a new uid token (aka advertising token) | ||
public class AdvertisingTokenRequest extends VersionedTokenRequest { | ||
public final OperatorIdentity operatorIdentity; | ||
public final SourcePublisher sourcePublisher; | ||
public final RawUid rawUid; | ||
public final PrivacyBits privacyBits; | ||
public final Instant establishedAt; | ||
|
||
public AdvertisingTokenRequest(TokenVersion version, Instant createdAt, Instant expiresAt, OperatorIdentity operatorIdentity, | ||
SourcePublisher sourcePublisher, RawUid rawUid, PrivacyBits privacyBits, | ||
Instant establishedAt) { | ||
super(version, createdAt, expiresAt); | ||
this.operatorIdentity = operatorIdentity; | ||
this.sourcePublisher = sourcePublisher; | ||
this.rawUid = rawUid; | ||
this.privacyBits = privacyBits; | ||
this.establishedAt = establishedAt; | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.uid2.operator.model; | ||
|
||
// Contains the computed raw UID and its bucket ID from identity/map request | ||
public class IdentityMapResponseItem { | ||
public static final IdentityMapResponseItem OptoutIdentity = new IdentityMapResponseItem(new byte[33], ""); | ||
// The raw UID is also known as Advertising Id (historically) | ||
public final byte[] rawUid; | ||
public final String bucketId; | ||
|
||
public IdentityMapResponseItem(byte[] rawUid, String bucketId) { | ||
this.rawUid = rawUid; | ||
this.bucketId = bucketId; | ||
} | ||
|
||
// historically Optout is known as Logout | ||
public boolean isOptedOut() { | ||
return this.equals(OptoutIdentity) || this.bucketId == null || this.bucketId.isEmpty(); | ||
} | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.uid2.operator.model; | ||
|
||
// The original publisher that requests to generate a UID token | ||
public class SourcePublisher { | ||
public final int siteId; | ||
|
||
// these 2 values are added into adverting/UID token and refresh token payload but | ||
// are not really used for any real purposes currently so sometimes are set to 0 | ||
// see the constructor below | ||
public final int clientKeyId; | ||
public final long publisherId; | ||
|
||
public SourcePublisher(int siteId, int clientKeyId, long publisherId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is always constructed as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great suggestion - done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's because it is a half- (well, 5%) baked feature. There is nothing special about values 0. Maybe worth putting some comment about this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i have added this comment in the class:
|
||
this.siteId = siteId; | ||
this.clientKeyId = clientKeyId; | ||
this.publisherId = publisherId; | ||
} | ||
|
||
public SourcePublisher(int siteId) { | ||
this.siteId = siteId; | ||
this.clientKeyId = 0; | ||
this.publisherId = 0; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.uid2.operator.model; | ||
|
||
import com.uid2.operator.model.identities.HashedDii; | ||
import com.uid2.operator.util.PrivacyBits; | ||
|
||
import java.time.Instant; | ||
|
||
public final class TokenGenerateRequest { | ||
public final SourcePublisher sourcePublisher; | ||
public final HashedDii hashedDii; | ||
public final OptoutCheckPolicy optoutCheckPolicy; | ||
|
||
public final PrivacyBits privacyBits; | ||
public final Instant establishedAt; | ||
|
||
public TokenGenerateRequest( | ||
SourcePublisher sourcePublisher, | ||
HashedDii hashedDii, | ||
OptoutCheckPolicy tokenGeneratePolicy, | ||
PrivacyBits privacyBits, | ||
Instant establishedAt) { | ||
this.sourcePublisher = sourcePublisher; | ||
this.hashedDii = hashedDii; | ||
this.optoutCheckPolicy = tokenGeneratePolicy; | ||
this.privacyBits = privacyBits; | ||
this.establishedAt = establishedAt; | ||
} | ||
|
||
public TokenGenerateRequest( | ||
SourcePublisher sourcePublisher, | ||
HashedDii hashedDii, | ||
OptoutCheckPolicy tokenGeneratePolicy) { | ||
this(sourcePublisher, hashedDii, tokenGeneratePolicy, PrivacyBits.DEFAULT, Instant.now()); | ||
|
||
} | ||
|
||
public boolean shouldCheckOptOut() { | ||
return optoutCheckPolicy.equals(OptoutCheckPolicy.RespectOptOut); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering why some file renames don't show up as such in the changes ? such as RefreshToken to RefreshTokenInput.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no idea :)