1717
1818public class EncryptedTokenEncoder implements ITokenEncoder {
1919 private final KeyManager keyManager ;
20- private final IdentityEnvironment identityEnvironment ;
21-
22- public EncryptedTokenEncoder (KeyManager keyManager , IdentityEnvironment identityEnvironment ) {
20+ public EncryptedTokenEncoder (KeyManager keyManager ) {
2321 this .keyManager = keyManager ;
24- this .identityEnvironment = identityEnvironment ;
2522 }
2623
2724 public byte [] encode (AdvertisingToken t , Instant asOf ) {
@@ -126,7 +123,7 @@ private RefreshToken decodeRefreshTokenV2(Buffer b) {
126123 TokenVersion .V2 , createdAt , validTill ,
127124 new OperatorIdentity (0 , OperatorType .Service , 0 , 0 ),
128125 new PublisherIdentity (siteId , 0 , 0 ),
129- new UserIdentity (IdentityScope .UID2 , IdentityType .Email , this . identityEnvironment , identity , privacyBits , Instant .ofEpochMilli (establishedMillis ), null ));
126+ new UserIdentity (IdentityScope .UID2 , IdentityType .Email , identity , privacyBits , Instant .ofEpochMilli (establishedMillis ), null ));
130127 }
131128
132129 private RefreshToken decodeRefreshTokenV3 (Buffer b , byte [] bytes ) {
@@ -148,6 +145,7 @@ private RefreshToken decodeRefreshTokenV3(Buffer b, byte[] bytes) {
148145 final Instant establishedAt = Instant .ofEpochMilli (b2 .getLong (49 ));
149146 final IdentityScope identityScope = decodeIdentityScopeV3 (b2 .getByte (57 ));
150147 final IdentityType identityType = decodeIdentityTypeV3 (b2 .getByte (57 ));
148+
151149 final byte [] id = b2 .getBytes (58 , 90 );
152150
153151 if (identityScope != decodeIdentityScopeV3 (b .getByte (0 ))) {
@@ -159,7 +157,7 @@ private RefreshToken decodeRefreshTokenV3(Buffer b, byte[] bytes) {
159157
160158 return new RefreshToken (
161159 TokenVersion .V3 , createdAt , expiresAt , operatorIdentity , publisherIdentity ,
162- new UserIdentity (identityScope , identityType , this . identityEnvironment , id , privacyBits , establishedAt , null ));
160+ new UserIdentity (identityScope , identityType , id , privacyBits , establishedAt , null ));
163161 }
164162
165163 @ Override
@@ -227,7 +225,7 @@ public AdvertisingToken decodeAdvertisingTokenV2(Buffer b) {
227225 Instant .ofEpochMilli (expiresMillis ),
228226 new OperatorIdentity (0 , OperatorType .Service , 0 , masterKeyId ),
229227 new PublisherIdentity (siteId , siteKeyId , 0 ),
230- new UserIdentity (IdentityScope .UID2 , IdentityType .Email , this . identityEnvironment , advertisingId , privacyBits , Instant .ofEpochMilli (establishedMillis ), null )
228+ new UserIdentity (IdentityScope .UID2 , IdentityType .Email , advertisingId , privacyBits , Instant .ofEpochMilli (establishedMillis ), null )
231229 );
232230
233231 } catch (Exception e ) {
@@ -265,7 +263,7 @@ public AdvertisingToken decodeAdvertisingTokenV3orV4(Buffer b, byte[] bytes, Tok
265263
266264 return new AdvertisingToken (
267265 tokenVersion , createdAt , expiresAt , operatorIdentity , publisherIdentity ,
268- new UserIdentity (identityScope , identityType , this . identityEnvironment , id , privacyBits , establishedAt , refreshedAt )
266+ new UserIdentity (identityScope , identityType , id , privacyBits , establishedAt , refreshedAt )
269267 );
270268 }
271269
0 commit comments