File: credentials.rb

package info (click to toggle)
ruby-rugged 1.5.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,748 kB
  • sloc: ansic: 8,746; ruby: 7,464; sh: 94; makefile: 5
file content (48 lines) | stat: -rw-r--r-- 1,268 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright (C) the Rugged contributors.  All rights reserved.
#
# This file is part of Rugged, distributed under the MIT license.
# For full terms see the included LICENSE file.

module Rugged
  module Credentials
    # A plain-text username and password credential object.
    class UserPassword
      def initialize(options)
        @username, @password = options[:username], options[:password]
      end

      def call(url, username_from_url, allowed_types)
        self
      end
    end

    # A ssh key credential object that can optionally be passphrase-protected
    class SshKey
      def initialize(options)
        @username, @publickey, @privatekey, @passphrase = options[:username], options[:publickey], options[:privatekey], options[:passphrase]
      end

      def call(url, username_from_url, allowed_types)
        self
      end
    end

    class SshKeyFromAgent
      def initialize(options)
        @username = options[:username]
      end

      def call(url, username_from_url, allowed_types)
        self
      end
    end

    # A "default" credential usable for Negotiate mechanisms like NTLM or
    # Kerberos authentication
    class Default
      def call(url, username_from_url, allowed_types)
        self
      end
    end
  end
end