metacello icon indicating copy to clipboard operation
metacello copied to clipboard

username and password specification for repositories

Open dalehenrich opened this issue 11 years ago • 7 comments

The most obvious way to include the username and password is to:

Metacello new
  project: 'Sample';
  version: '1.0.0';
  repository: 'http://example.com' username: 'user' password: 'pass';
  load.

but an interesting alternative would something along the lines of:

  Metacello repository
    repository: 'http://example.com' username: 'user' password: 'pass';
   create.

then you could just have a list of repos and predefine the credentials ... maybe not:)

dalehenrich avatar Jul 27 '12 22:07 dalehenrich

An alternative suggested by Johan Brichau is to allow one to pass a repository instance where a repository description is allowed ... that way we don't have to add the extra args for credentials to all of the repository methods ...

Another alternative would seem to be to extend the repository description syntax to include a username/password

dalehenrich avatar Jul 28 '12 15:07 dalehenrich

I think being able to pass a repository instance instead of a description is a good idea (as in support both).

Also think a more general URI scheme is about to emerge naturally as we have http, directory, github, filetree, etc. http URI's already have the existing standard for username and password (http://user:passwd@hostname/path/), several of the other potentials also have well defined URI's on their own, and it'd be pretty easy to delegate the parsing job to be "protocol" specific and leave it up to that component to interpret the URI.

sundbp avatar Jul 31 '12 09:07 sundbp

Ah, very good point about http://user:passwd@hostname/path/, however, the URIs in Metacello are used to create instances of MCRepository and the creation messages typically separate out the username and passwords which then are reconstructed underneath the covers ...

I'd forgotten about the @ convention and will use it ... now I think it's clear for this issue:

  • use @ convention for username/password in repository URI
  • allow live repository objects to be passed in

dalehenrich avatar Jul 31 '12 17:07 dalehenrich

I agree. Cool.

On it being used to create MCRepository: the protocol of MCRepository isn't really a problem I'd think, in metacello we're free to add an abstraction layer that has let's say MetacelloHttpURIParser that works out how to parse the string and then creates the right MCRepository using whatever protocol is sensible given the URI given. And similarly one could have MetacelloGithubURIParser and so forth.

sundbp avatar Jul 31 '12 18:07 sundbp

I've been exploring this issue in Pharo. See Pharo Issue 6449: ENH: MCHttpRepository Authentication. This goes beyond Metacello. MCRepositories that can have authentication should support that in the model. There should be a way to save credentials for various servers, that will then be used everywhere in the image.

seandenigris avatar Jul 31 '12 23:07 seandenigris

It is true that the credentials is larger than Metacello, but with repository URIs in the specifications I have to have a place for them (even if most people will want to hide their passwords) so I need a way to accommodate that which boils down to:

  • support live repos (handled by Pharo-based mechanism)
  • support credentials in repository spec to support creation of repositories with credentials on demand (which is what Metacello does today)

supporting the credentials in the repository spec will be easy compared to passing live repositories into the scripts - I don't have a good place to stash a live repository ... I may just end up adding the repo to the default group and then turning the repo into a repository description:)

dalehenrich avatar Aug 01 '12 00:08 dalehenrich

Can we close this via #536 or are there any further requirements?

LinqLover avatar Nov 08 '20 00:11 LinqLover