Skip to content

Instantly share code, notes, and snippets.

@crspybits
Created October 23, 2021 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crspybits/65c592d1905a33e5b2d79394d10e59b1 to your computer and use it in GitHub Desktop.
Save crspybits/65c592d1905a33e5b2d79394d10e59b1 to your computer and use it in GitHub Desktop.
ServerParameters
// Typical parameters to send to a server
// See https://github.com/crspybits/SolidAuthSwift/issues/6
public struct ServerParameters: Codable {
public let refresh: RefreshParameters
// This should be something like "https://crspybits.trinpod.us", "https://crspybits.inrupt.net", or "https://pod.inrupt.com/crspybits".
// Aka. host URL; see https://github.com/SyncServerII/ServerSolidAccount/issues/4
// If this is nil (i.e., it could not be obtained here), and your app needs it, you'll need to prompt the user for it. If it is not nil, you might want to confirm the specific storage location your app plans to use with the user anyways. E.g., your app might want to use "https://pod.inrupt.com/crspybits/YourAppPath/".
public let storageIRI: URL?
// https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
// URL of the OP's JSON Web Key Set [JWK] document.
// This is needed on the server to verify the id token.
public let jwksURL: URL
// See https://github.com/solid/webid-oidc-spec#deriving-webid-uri-from-id-token
// and https://solidproject.org/faqs#what-is-a-webid
// I'm making this non-optional so that a server can be assured to have a unique way to identify Solid users.
public let webid: String
// An initial access token because (a) we have it on the client, and (b) to get the server started.
public let accessToken: String
public init(refresh: RefreshParameters, storageIRI: URL?, jwksURL: URL, webid: String, accessToken: String) {
self.refresh = refresh
self.storageIRI = storageIRI
self.jwksURL = jwksURL
self.webid = webid
self.accessToken = accessToken
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment