Skip to content

Commit 7115125

Browse files
author
Tobias Theel
committed
stuff
1 parent 099ec70 commit 7115125

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
*.orig
2+
13
# Other stuff aslong as i'm to lazy to use environment variables
24
*.secret.go
35

client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func (client *gocloak) LoginClient(clientID, clientSecret, realm string) (*JWT,
234234
}
235235

236236
if res.StatusCode != 200 {
237-
log.Println(string(body))
237+
return nil, errors.New(res.Status)
238238
}
239239

240240
jwt := &JWT{}

client_test.go

+9
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ func TestGetCerts(t *testing.T) {
4343

4444
t.Log(certs)
4545
}
46+
func Test_LoginClient_UnknownRealm(t *testing.T) {
47+
t.Parallel()
48+
client := NewClient(hostname)
49+
_, err := client.LoginClient(clientid, clientSecret, "blacklayer")
50+
if err != nil {
51+
t.Log("Login failed", err.Error())
52+
t.FailNow()
53+
}
54+
}
4655

4756
func TestGetIssuer(t *testing.T) {
4857
t.Parallel()

test.json

Whitespace-only changes.

0 commit comments

Comments
 (0)