Skip to content

Commit

Permalink
Merge pull request #860 from tesonep/dev-1.0
Browse files Browse the repository at this point in the history
CredentialStore API
  • Loading branch information
guillep authored Jun 18, 2018
2 parents 63f7d4b + 51cbb52 commit e888c6f
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
running
tearDown
file ifNotNil: [ file ensureDelete ].
dir ifNotNil: [ dir ensureDeleteAll ].
super tearDown
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tests
testDeprecatedAPI
self
should: [ IceCredentialsProvider
plaintextCredentials:
(IcePlaintextCredentials new
username: 'anUser';
password: '*****';
yourself) ]
raise: Deprecation
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests
testDeprecatedGetterAPI
self should: [ IceCredentialsProvider plaintextCredentials ] raise: Deprecation
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
tests - store
testStoreInNonExistingDirectory

| newStore cred otherStore |

dir := FileLocator temp / 'nonExisting'.
file := FileLocator temp / 'nonExisting' / 'nonExisting.fuel'.

self deny: dir exists.

newStore := IceCredentialStore new
storeFile: file;
saveIntoStore;
yourself.

newStore storeCredential: (IcePlaintextCredentials new
host: 'github.com';
password: 'aasd';
username: 'aaa';
yourself).

otherStore := IceCredentialStore new
storeFile: file;
loadFromStore;
yourself.

cred := otherStore plaintextCredentialForHostname: 'github.com'.
self assert: cred isPresent.


Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
tests - store
testStoreInNonExistingFile

| newStore cred otherStore |

file := FileLocator temp / 'nonExisting.fuel'.

newStore := IceCredentialStore new
storeFile: file;
saveIntoStore;
yourself.

newStore storeCredential: (IcePlaintextCredentials new
host: 'github.com';
password: 'aasd';
username: 'aaa';
yourself).

otherStore := IceCredentialStore new
storeFile: file;
loadFromStore;
yourself.

cred := otherStore plaintextCredentialForHostname: 'github.com'.
self assert: cred isPresent.


Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"classvars" : [ ],
"instvars" : [
"store",
"file"
"file",
"dir"
],
"name" : "IceCredentialStoreTest",
"type" : "normal"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
deprecated
plaintextCredentials: anIcePlaintextCredentials

self deprecated: '
This API has been deprecated. The new CredentialStore hosts the keys by hostname.
The code should be changed to:
IceCredentialStore current
storeCredential: (IcePlaintextCredentials new
username: ''user'';
password: ''password'';
host: ''github.com'';
yourself).
However this modification will break with older versions of Iceberg ( < 1.1.0 ).
This method does nothing for compatibility.'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
deprecated
plaintextCredentials

self deprecated: '
This method have been deprecated. The new CredentialStore keeps the keys by host. There is no default key for all the hosts.
You should use:
CredentialStore current plaintextCredentialForHostname: ''aHost.com''.
This method will return an empty IcePlaintextCredentials for compatibility.
Attention: Changing any script to use this new API, will break compatibility with Iceberg version < 1.1.0
'.

^ IcePlaintextCredentials new

0 comments on commit e888c6f

Please sign in to comment.