token_exchanger.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. Copyright © The ESO Authors
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. https://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. // Package iam provides a client interface and implementations for Nebius IAM.
  14. package iam
  15. import (
  16. "context"
  17. "time"
  18. )
  19. // Token represents an IAM token with its value, expiration time, and issuance time.
  20. type Token struct {
  21. Token string
  22. ExpiresAt time.Time
  23. IssuedAt time.Time
  24. }
  25. // TokenExchanger is an interface for exchanging credentials to obtain IAM tokens.
  26. type TokenExchanger interface {
  27. ExchangeIamToken(ctx context.Context, apiDomain, subjectCreds string, issuedAt time.Time, caCertificate []byte) (*Token, error)
  28. }