Okechi Onyeje 031a354996 Ebay Listing Now Posts both information and single image
need to rework on categories since subcategory workflow added some complications, but that will be taken care of in a bug fix task
2016-08-23 13:48:34 -04:00

76 lines
2.3 KiB
Swift

/*
* JBoss, Home of Professional Open Source.
* Copyright Red Hat, Inc., and individual contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Foundation
/**
The protocol that an OAuth2 Session modules must adhere to and represent storage of oauth specific metadata. See TrustedPersistantOAuth2Session and UntrustedMemoryOAuth2Session as example implementations
*/
public protocol OAuth2Session {
/**
The account id.
*/
var accountId: String {get}
/**
The access token which expires.
*/
var accessToken: String? {get set}
/**
The access token's expiration date.
*/
var accessTokenExpirationDate: NSDate? {get set}
/**
The refresh token's expiration date.
*/
var refreshTokenExpirationDate: NSDate? {get set}
/**
The refresh tokens. This toke does not expire and should be used to renew access token when expired.
*/
var refreshToken: String? {get set}
/**
Check validity of accessToken. return true if still valid, false when expired.
*/
func tokenIsNotExpired() -> Bool
/**
Check validity of refreshToken. return true if still valid, false when expired.
*/
func refreshTokenIsNotExpired() -> Bool
/**
Clears any tokens storage
*/
func clearTokens()
/**
Save tokens information. Saving tokens allow you to refresh accesstoken transparently for the user without prompting
for grant access.
:param: accessToken the access token.
:param: refreshToken the refresh token.
:param: accessTokenExpiration the expiration for the access token.
:param: refreshTokenExpiration the expiration for the refresh token.
*/
func saveAccessToken(accessToken: String?, refreshToken: String?, accessTokenExpiration: String?, refreshTokenExpiration: String?)
}