@@ -113,7 +113,7 @@ open class OAuth2Securable: OAuth2Requestable {
113113 logger? . debug ( " OAuth2 " , msg: " Looking for items in keychain " )
114114
115115 do {
116- var creds = OAuth2KeychainAccount ( oauth2: self , account: keychainAccountForClientCredentials)
116+ var creds = OAuth2KeychainAccount ( oauth2: self , account: keychainAccountForClientCredentials, classes : storableCredentialClasses ( ) )
117117 let creds_data = try creds. fetchedFromKeychain ( )
118118 updateFromKeychainItems ( creds_data)
119119 logger? . trace ( " OAuth2 " , msg: " Client credentials updated from keychain: \( creds_data) " )
@@ -123,7 +123,7 @@ open class OAuth2Securable: OAuth2Requestable {
123123 }
124124
125125 do {
126- var toks = OAuth2KeychainAccount ( oauth2: self , account: keychainAccountForTokens)
126+ var toks = OAuth2KeychainAccount ( oauth2: self , account: keychainAccountForTokens, classes : storableTokenClasses ( ) )
127127 let toks_data = try toks. fetchedFromKeychain ( )
128128 updateFromKeychainItems ( toks_data)
129129 logger? . trace ( " OAuth2 " , msg: " Tokens updated from keychain: \( toks_data) " )
@@ -134,23 +134,27 @@ open class OAuth2Securable: OAuth2Requestable {
134134 }
135135
136136 /** Updates instance properties according to the items found in the given dictionary, which was found in the keychain. */
137- func updateFromKeychainItems( _ items: [ String : Any ] ) {
137+ func updateFromKeychainItems( _ items: [ String : any Sendable ] ) {
138+ }
139+
140+ open func storableCredentialClasses( ) -> [ AnyClass ] {
141+ return [ ]
138142 }
139143
140144 /**
141145 Items that should be stored when storing client credentials.
142146
143147 - returns: A dictionary with `String` keys and `Any` items
144148 */
145- open func storableCredentialItems( ) -> [ String : Any ] ? {
149+ open func storableCredentialItems( ) -> [ String : any Sendable ] ? {
146150 return nil
147151 }
148152
149153 /** Stores our client credentials in the keychain. */
150154 open func storeClientToKeychain( ) {
151155 if let items = storableCredentialItems ( ) {
152156 logger? . debug ( " OAuth2 " , msg: " Storing client credentials to keychain " )
153- let keychain = OAuth2KeychainAccount ( oauth2: self , account: keychainAccountForClientCredentials, data: items)
157+ let keychain = OAuth2KeychainAccount ( oauth2: self , account: keychainAccountForClientCredentials, data: items, classes : storableCredentialClasses ( ) )
154158 do {
155159 try keychain. saveInKeychain ( )
156160 logger? . trace ( " OAuth2 " , msg: " Client credentials stored to keychain: \( items) " )
@@ -161,20 +165,24 @@ open class OAuth2Securable: OAuth2Requestable {
161165 }
162166 }
163167
168+ open func storableTokenClasses( ) -> [ AnyClass ] {
169+ return [ ]
170+ }
171+
164172 /**
165173 Items that should be stored when tokens are stored to the keychain.
166174
167175 - returns: A dictionary with `String` keys and `Any` items
168176 */
169- open func storableTokenItems( ) -> [ String : Any ] ? {
177+ open func storableTokenItems( ) -> [ String : any Sendable ] ? {
170178 return nil
171179 }
172180
173181 /** Stores our current token(s) in the keychain. */
174182 public func storeTokensToKeychain( ) {
175183 if let items = storableTokenItems ( ) {
176184 logger? . debug ( " OAuth2 " , msg: " Storing tokens to keychain " )
177- let keychain = OAuth2KeychainAccount ( oauth2: self , account: keychainAccountForTokens, data: items)
185+ let keychain = OAuth2KeychainAccount ( oauth2: self , account: keychainAccountForTokens, data: items, classes : storableTokenClasses ( ) )
178186 do {
179187 try keychain. saveInKeychain ( )
180188 logger? . trace ( " OAuth2 " , msg: " Tokens stored to keychain: \( items) " )
0 commit comments