mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-17 02:55:11 +00:00
* feat: add possibility to ignore username errors on first login screen * console changes * fix: handling of unknown usernames (#3445) * fix: handling of unknown usernames * fix: handle HideLoginNameSuffix on unknown users * feat: add default redirect uri on login policy (#3607) * feat: add default redirect uri on login policy * fix tests * feat: Console login policy default redirect (#3613) * console default redirect * placeholder * validate default redirect uri * allow empty default redirect uri Co-authored-by: Max Peintner <[email protected]> * remove wonrgly cherry picked migration Co-authored-by: Max Peintner <[email protected]>
74 lines
1000 B
Go
74 lines
1000 B
Go
package domain
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestValidateDefaultRedirectURI(t *testing.T) {
|
|
type args struct {
|
|
rawURL string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want bool
|
|
}{
|
|
{
|
|
"invalid url, false",
|
|
args{
|
|
rawURL: string('\n'),
|
|
},
|
|
false,
|
|
},
|
|
{
|
|
"empty schema, false",
|
|
args{
|
|
rawURL: "url",
|
|
},
|
|
false,
|
|
},
|
|
{
|
|
"empty http host, false",
|
|
args{
|
|
rawURL: "http://",
|
|
},
|
|
false,
|
|
},
|
|
{
|
|
"empty https host, false",
|
|
args{
|
|
rawURL: "https://",
|
|
},
|
|
false,
|
|
},
|
|
{
|
|
"https, ok",
|
|
args{
|
|
rawURL: "https://test",
|
|
},
|
|
true,
|
|
},
|
|
{
|
|
"custom schema, ok",
|
|
args{
|
|
rawURL: "custom://",
|
|
},
|
|
true,
|
|
},
|
|
{
|
|
"empty url, ok",
|
|
args{
|
|
rawURL: "",
|
|
},
|
|
true,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
assert.Equalf(t, tt.want, ValidateDefaultRedirectURI(tt.args.rawURL), "ValidateDefaultRedirectURI(%v)", tt.args.rawURL)
|
|
})
|
|
}
|
|
}
|