-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scopes are currently passed as a scope string, separating scopes by spaces. Clients can grow to many scopes, resulting in a very long string. This change allows us to specify scopes using the property scopeArray. That way, we can separate scopes by newlines. Additionally, this allows us to comment a single scope temporarily or add a comment for a specific scope, e.g. as a reason why that client has this scope granted.
- Loading branch information
1 parent
aa0bff2
commit d02d5ca
Showing
4 changed files
with
52 additions
and
5 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package hydra_test | ||
|
||
import ( | ||
"testing" | ||
|
||
hydrav1alpha1 "github.com/ory/hydra-maester/api/v1alpha1" | ||
"github.com/ory/hydra-maester/hydra" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestTypes(t *testing.T) { | ||
t.Run("Test ScopeArray", func(t *testing.T) { | ||
c := hydrav1alpha1.OAuth2Client{ | ||
Spec: hydrav1alpha1.OAuth2ClientSpec{ | ||
ScopeArray: []string{"scope1", "scope2"}, | ||
}, | ||
} | ||
|
||
var parsedClient, err = hydra.FromOAuth2Client(&c) | ||
if err != nil { | ||
assert.Fail(t, "unexpected error: %s", err) | ||
} | ||
|
||
assert.Equal(t, parsedClient.Scope, "scope1 scope2") | ||
}) | ||
} |