-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #860 from tesonep/dev-1.0
CredentialStore API
- Loading branch information
Showing
8 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
Iceberg-Tests.package/IceCredentialStoreTest.class/instance/tearDown.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
10 changes: 10 additions & 0 deletions
10
Iceberg-Tests.package/IceCredentialStoreTest.class/instance/testDeprecatedAPI.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
3 changes: 3 additions & 0 deletions
3
Iceberg-Tests.package/IceCredentialStoreTest.class/instance/testDeprecatedGetterAPI.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tests | ||
testDeprecatedGetterAPI | ||
self should: [ IceCredentialsProvider plaintextCredentials ] raise: Deprecation |
30 changes: 30 additions & 0 deletions
30
...rg-Tests.package/IceCredentialStoreTest.class/instance/testStoreInNonExistingDirectory.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
|
27 changes: 27 additions & 0 deletions
27
Iceberg-Tests.package/IceCredentialStoreTest.class/instance/testStoreInNonExistingFile.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
Iceberg.package/IceCredentialsProvider.class/class/plaintextCredentials..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.' |
16 changes: 16 additions & 0 deletions
16
Iceberg.package/IceCredentialsProvider.class/class/plaintextCredentials.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |