mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
ec5020bebc
* begin refresh tokens * refresh tokens * list and revoke refresh tokens * handle remove * tests for refresh tokens * uniqueness and default expiration * rename oidc token methods * cleanup * migration version * Update internal/static/i18n/en.yaml Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com> * fixes * feat: update oidc pkg for refresh tokens Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
31 lines
977 B
Go
31 lines
977 B
Go
package user
|
|
|
|
import (
|
|
"google.golang.org/protobuf/types/known/timestamppb"
|
|
|
|
"github.com/caos/zitadel/internal/api/grpc/object"
|
|
"github.com/caos/zitadel/internal/user/model"
|
|
"github.com/caos/zitadel/pkg/grpc/user"
|
|
)
|
|
|
|
func RefreshTokensToPb(refreshTokens []*model.RefreshTokenView) []*user.RefreshToken {
|
|
tokens := make([]*user.RefreshToken, len(refreshTokens))
|
|
for i, token := range refreshTokens {
|
|
tokens[i] = RefreshTokenToPb(token)
|
|
}
|
|
return tokens
|
|
}
|
|
|
|
func RefreshTokenToPb(token *model.RefreshTokenView) *user.RefreshToken {
|
|
return &user.RefreshToken{
|
|
Id: token.ID,
|
|
Details: object.ToViewDetailsPb(token.Sequence, token.CreationDate, token.ChangeDate, token.ResourceOwner),
|
|
ClientId: token.ClientID,
|
|
AuthTime: timestamppb.New(token.AuthTime),
|
|
IdleExpiration: timestamppb.New(token.IdleExpiration),
|
|
Expiration: timestamppb.New(token.Expiration),
|
|
Scopes: token.Scopes,
|
|
Audience: token.Audience,
|
|
}
|
|
}
|