[MM-25780] Fix incorrect session length when logging in through mobile using SSO (#14874)
* Pass device ID * dont use device id as way of detecting * fix spelling mistake * update layers * fix test * fix linting * save schema * put columns in correct place * fix linting * update * upgrade go change * use props * fix stuff * update session tests * address PR comments * address PR comments
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
df943fbf91
Коммит
4c50c7c59b
@@ -206,6 +206,35 @@ func TestApp_GetSessionLengthInMillis(t *testing.T) {
|
||||
require.Equal(t, dayMillis*3, sessionLength)
|
||||
})
|
||||
|
||||
t.Run("get session length mobile when isMobile in props is set", func(t *testing.T) {
|
||||
session := &model.Session{
|
||||
UserId: model.NewId(),
|
||||
Props: map[string]string{
|
||||
model.USER_AUTH_SERVICE_IS_MOBILE: "true",
|
||||
},
|
||||
}
|
||||
session, err := th.App.CreateSession(session)
|
||||
require.Nil(t, err)
|
||||
|
||||
sessionLength := th.App.GetSessionLengthInMillis(session)
|
||||
require.Equal(t, dayMillis*3, sessionLength)
|
||||
})
|
||||
|
||||
t.Run("get session length mobile when isMobile in props is set and takes priority over saml", func(t *testing.T) {
|
||||
session := &model.Session{
|
||||
UserId: model.NewId(),
|
||||
Props: map[string]string{
|
||||
model.USER_AUTH_SERVICE_IS_MOBILE: "true",
|
||||
model.USER_AUTH_SERVICE_IS_SAML: "true",
|
||||
},
|
||||
}
|
||||
session, err := th.App.CreateSession(session)
|
||||
require.Nil(t, err)
|
||||
|
||||
sessionLength := th.App.GetSessionLengthInMillis(session)
|
||||
require.Equal(t, dayMillis*3, sessionLength)
|
||||
})
|
||||
|
||||
t.Run("get session length SSO", func(t *testing.T) {
|
||||
session := &model.Session{
|
||||
UserId: model.NewId(),
|
||||
@@ -218,6 +247,19 @@ func TestApp_GetSessionLengthInMillis(t *testing.T) {
|
||||
require.Equal(t, dayMillis*2, sessionLength)
|
||||
})
|
||||
|
||||
t.Run("get session length SSO using props", func(t *testing.T) {
|
||||
session := &model.Session{
|
||||
UserId: model.NewId(),
|
||||
Props: map[string]string{
|
||||
model.USER_AUTH_SERVICE_IS_SAML: "true",
|
||||
}}
|
||||
session, err := th.App.CreateSession(session)
|
||||
require.Nil(t, err)
|
||||
|
||||
sessionLength := th.App.GetSessionLengthInMillis(session)
|
||||
require.Equal(t, dayMillis*2, sessionLength)
|
||||
})
|
||||
|
||||
t.Run("get session length web/LDAP", func(t *testing.T) {
|
||||
session := &model.Session{
|
||||
UserId: model.NewId(),
|
||||
|
||||
Ссылка в новой задаче
Block a user