Skip to content

Instantly share code, notes, and snippets.

@crspybits
Created October 23, 2021 21:09
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/dd44d695a67cf77d210969cc90012e92 to your computer and use it in GitHub Desktop.
Save crspybits/dd44d695a67cf77d210969cc90012e92 to your computer and use it in GitHub Desktop.
SignInConfiguration
public struct SignInConfiguration {
// e.g., "https://solidcommunity.net"
public let issuer: String
// E.g., "biz.SpasticMuffin.Neebla.demo:/mypath"
public let redirectURI: String
var redirectURL: URL? {
return URL(string: redirectURI)
}
var redirectScheme:String? {
return redirectURL?.scheme
}
public let postLogoutRedirectURI: String?
var postLogoutRedirectURL: URL? {
guard let postLogoutRedirectURI = postLogoutRedirectURI else {
return nil
}
return URL(string: postLogoutRedirectURI)
}
var postLogoutRedirectScheme:String? {
return postLogoutRedirectURL?.scheme
}
// It looks like this should show up in the sign in UI for the Pod. But not seeing it yet when using solidcommunity.net.
public let clientName: String
// e.g., [.openid, .profile, .webid, .offlineAccess]
public let scopes: Set<Scope>
// e.g., [.code, .token]
let responseTypes: Set<ResponseType>
let grantTypes: Set<GrantType>
let authenticationMethod: TokenEndpointAuthenticationMethod
// Can be used to provide context when presenting the sign in screen.
let presentationContextProvider: ASWebAuthenticationPresentationContextProviding?
public init(issuer: String, redirectURI: String, postLogoutRedirectURI: String? = nil, clientName: String, scopes: Set<Scope>, responseTypes: Set<ResponseType>, grantTypes: Set<GrantType>, authenticationMethod: TokenEndpointAuthenticationMethod, presentationContextProvider: ASWebAuthenticationPresentationContextProviding? = nil) {
self.issuer = issuer
self.redirectURI = redirectURI
self.postLogoutRedirectURI = postLogoutRedirectURI
self.clientName = clientName
self.scopes = scopes
self.responseTypes = responseTypes
self.grantTypes = grantTypes
self.authenticationMethod = authenticationMethod
self.presentationContextProvider = presentationContextProvider
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment