@ -1773,11 +1773,9 @@ func TestServerSupportedGrants(t *testing.T) {
resGrants [ ] string
} {
{
name : "Simple" ,
config : func ( c * Config ) {
c . AllowedGrantTypes = nil
} ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
name : "Simple" ,
config : func ( c * Config ) { } ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeClientCredentials , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
} ,
{
name : "Minimal" ,
@ -1787,46 +1785,36 @@ func TestServerSupportedGrants(t *testing.T) {
{
name : "With password connector" ,
config : func ( c * Config ) {
c . AllowedGrantTypes = nil
c . PasswordConnector = "local"
} ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypePassword , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeClientCredentials , grantType Password , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
} ,
{
name : "With token response " ,
name : "Without client credentials " ,
config : func ( c * Config ) {
c . AllowedGrantTypes = nil
c . SupportedResponseTypes = append ( c . SupportedResponseTypes , responseTypeToken )
c . AllowedGrantTypes = [ ] string {
grantTypeAuthorizationCode ,
grantTypeRefreshToken ,
grantTypeDeviceCode ,
grantTypeTokenExchange ,
}
} ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeImplicit , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
} ,
{
name : "All without feature flag " ,
name : "With token response " ,
config : func ( c * Config ) {
c . AllowedGrantTypes = nil
c . PasswordConnector = "local"
c . SupportedResponseTypes = append ( c . SupportedResponseTypes , responseTypeToken )
} ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeImplicit , grantTypePassword , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
} ,
{
name : "With client credentials feature flag" ,
config : func ( c * Config ) {
c . AllowedGrantTypes = nil
t . Setenv ( "DEX_CLIENT_CREDENTIAL_GRANT_ENABLED_BY_DEFAULT" , "true" )
} ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeClientCredentials , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeClientCredentials , grantTypeImplicit , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
} ,
{
name : "Explicit client credentials in AllowedGrantTypes " ,
name : "All" ,
config : func ( c * Config ) {
c . AllowedGrantTypes = [ ] string {
grantTypeAuthorizationCode ,
grantTypeClientCredentials ,
grantTypeRefreshToken ,
}
c . PasswordConnector = "local"
c . SupportedResponseTypes = append ( c . SupportedResponseTypes , responseTypeToken )
} ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeClientCredentials , grantTypeRefreshToken } ,
resGrants : [ ] string { grantTypeAuthorizationCode , grantTypeClientCredentials , grantTypeImplicit , grantTypePassword , grantTypeRefreshToken , grantTypeDeviceCode , grantTypeTokenExchange } ,
} ,
}