-
Notifications
You must be signed in to change notification settings - Fork 108
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 #156 from tfelix/feature/keystone3-auth-scoping
feat: Adds support for KeystoneV3 scoping during auth
- Loading branch information
Showing
14 changed files
with
259 additions
and
21 deletions.
There are no files selected for viewing
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
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
20 changes: 20 additions & 0 deletions
20
src/main/java/org/javaswift/joss/client/factory/AuthenticationMethodScope.java
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,20 @@ | ||
package org.javaswift.joss.client.factory; | ||
|
||
/** | ||
* The Keystone V3 API allows scoped authentication. By utilizing this option you can request a special scope during | ||
* authentication. | ||
* | ||
* Depending on the chosen AuthenticationMethodScope different options must be provided in the {@link AccountConfig} | ||
* object: | ||
* | ||
* <p>PROJECT_NAME: TenantName and Domain must be provided.</p> | ||
* <p>DOMAIN_NAME: Domain must be provided.</p> | ||
* | ||
* <b>Note:</b> Currently only project/tenant name and domain name are supported. Scoping to the project/tenant ID or | ||
* domain ID is not implemented. | ||
*/ | ||
public enum AuthenticationMethodScope { | ||
DEFAULT, | ||
PROJECT_NAME, | ||
DOMAIN_NAME | ||
} |
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
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
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
14 changes: 14 additions & 0 deletions
14
...java/org/javaswift/joss/command/shared/identity/authentication/KeystoneV3DomainScope.java
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,14 @@ | ||
package org.javaswift.joss.command.shared.identity.authentication; | ||
|
||
public class KeystoneV3DomainScope implements KeystoneV3Scope { | ||
|
||
private final KeystoneV3Domain domain; | ||
|
||
public KeystoneV3DomainScope(KeystoneV3Domain domain) { | ||
this.domain = domain; | ||
} | ||
|
||
public KeystoneV3Domain getDomain() { | ||
return domain; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...ava/org/javaswift/joss/command/shared/identity/authentication/KeystoneV3ProjectScope.java
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,32 @@ | ||
package org.javaswift.joss.command.shared.identity.authentication; | ||
|
||
public class KeystoneV3ProjectScope implements KeystoneV3Scope { | ||
|
||
private KeystoneV3ProjectWrapped project; | ||
|
||
public static class KeystoneV3ProjectWrapped { | ||
private final String name; | ||
private final KeystoneV3Domain domain; | ||
|
||
private KeystoneV3ProjectWrapped(String name, KeystoneV3Domain domain) { | ||
this.name = name; | ||
this.domain = domain; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public KeystoneV3Domain getDomain() { | ||
return domain; | ||
} | ||
} | ||
|
||
public KeystoneV3ProjectScope(String name, KeystoneV3Domain domain) { | ||
this.project = new KeystoneV3ProjectWrapped(name, domain); | ||
} | ||
|
||
public KeystoneV3ProjectWrapped getProject() { | ||
return project; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/org/javaswift/joss/command/shared/identity/authentication/KeystoneV3Scope.java
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,4 @@ | ||
package org.javaswift.joss.command.shared.identity.authentication; | ||
|
||
public interface KeystoneV3Scope { | ||
} |
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
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
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
23 changes: 23 additions & 0 deletions
23
src/test/resources/sample-v3-auth-scope-domain-request.json
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,23 @@ | ||
{ | ||
"auth": { | ||
"identity": { | ||
"methods": [ | ||
"password" | ||
], | ||
"password": { | ||
"user": { | ||
"name": "username", | ||
"password": "password", | ||
"domain": { | ||
"name": "domainName" | ||
} | ||
} | ||
} | ||
}, | ||
"scope":{ | ||
"domain":{ | ||
"name":"domainName" | ||
} | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/test/resources/sample-v3-auth-scope-project-request.json
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,26 @@ | ||
{ | ||
"auth": { | ||
"identity": { | ||
"methods": [ | ||
"password" | ||
], | ||
"password": { | ||
"user": { | ||
"name": "username", | ||
"password": "password", | ||
"domain": { | ||
"name": "domainName" | ||
} | ||
} | ||
} | ||
}, | ||
"scope":{ | ||
"project":{ | ||
"name":"projectName", | ||
"domain":{ | ||
"name":"domainName" | ||
} | ||
} | ||
} | ||
} | ||
} |