konnect icon indicating copy to clipboard operation
konnect copied to clipboard

Further improve usage as library

Open IljaN opened this issue 5 years ago • 1 comments

As #19 is merged we would like to propose some follow up changes to further improve embedding.

Configuration files/keys

Instead of storing the path to the file the bootstrap should contain the unmarshaled config struct. With this change the consumer can decide how the load/un-marshall the config during the boot-process (etcd, hard-coded, different format). This would also decouple the business-logic from any io which should also improve test-ability.

This will require some concept on how to add extension-points to the bootstrap. (Extend interface introduced in #19 ?)

Assets (index.html)

Similar as above but here the path to index.html would be replaced by an io.reader of to allow loading assets from an vfs or do some other processing. Identifier-webapp should be optional as it might be hosted on another server.

IljaN avatar Feb 12 '20 14:02 IljaN

Mockup to better bring the point across:

// Implementation of the bootstrap interface
type bootstrap struct {
	signInFormURI            *url.URL
	signedOutURI             *url.URL
	authorizationEndpointURI *url.URL
	endSessionEndpointURI    *url.URL

	tlsClientConfig *tls.Config

	issuerIdentifierURI        *url.URL
	identifierClient       	   *[]os.FileInfo   // !
	identifierRegistrationConf *clients.RegistryData // !
	identifierAuthoritiesConf  *authorities.Registry // !
	identifierScopesConf       *[]scopes.Definition // !

	encryptionSecret []byte
	signingMethod    jwt.SigningMethod
	signingKeyID     string
	signers          map[string]crypto.Signer
	validators       map[string]crypto.PublicKey

	accessTokenDurationSeconds uint64
	uriBasePath                string

	cfg      *config.Config
	managers *managers.Managers
}

IljaN avatar Feb 12 '20 14:02 IljaN