Skip to content

Commit

Permalink
Update icommands environment and account struct to add default checks…
Browse files Browse the repository at this point in the history
…um scheme
  • Loading branch information
iychoi committed Jun 11, 2024
1 parent d30dc13 commit 16fca4e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions icommands/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func CreateIcommandsEnvironmentManagerFromIRODSAccount(account *types.IRODSAccou
Username: username,
Zone: zone,
DefaultResource: account.DefaultResource,
DefaultHashScheme: account.DefaultHashScheme,
}

if account.SSLConfiguration != nil {
Expand Down
2 changes: 2 additions & 0 deletions icommands/environment_raw.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func getDefaultICommandsEnvironment() *ICommandsEnvironment {
AuthenticationScheme: "native",
ClientServerNegotiation: "", // don't perform negotiation
ClientServerPolicy: string(types.CSNegotiationRequireTCP),
DefaultHashScheme: "SHA256",
EncryptionKeySize: 32,
EncryptionAlgorithm: "AES-256-CBC",
EncryptionSaltSize: 8,
Expand Down Expand Up @@ -102,6 +103,7 @@ func (env *ICommandsEnvironment) ToIRODSAccount() *types.IRODSAccount {
ProxyZone: env.Zone,
Password: "",
DefaultResource: env.DefaultResource,
DefaultHashScheme: env.DefaultHashScheme,
PamTTL: types.PamTTLDefault,
PamToken: "",
SSLConfiguration: &types.IRODSSSLConfig{
Expand Down
11 changes: 11 additions & 0 deletions irods/types/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const (
// PamTTLDefault is a default value for Pam TTL
PamTTLDefault int = 1
UsernameRegexString string = "^((\\w|[-.@])+)$"
HashSchemeDefault string = "SHA256"
)

// IRODSAccount contains irods login information
Expand All @@ -28,6 +29,7 @@ type IRODSAccount struct {
Password string
Ticket string
DefaultResource string
DefaultHashScheme string
PamTTL int
PamToken string
SSLConfiguration *IRODSSSLConfig
Expand All @@ -51,6 +53,7 @@ func CreateIRODSAccount(host string, port int, user string, zone string,
Password: password,
Ticket: "",
DefaultResource: defaultResource,
DefaultHashScheme: HashSchemeDefault,
PamTTL: PamTTLDefault,
PamToken: "",
SSLConfiguration: nil,
Expand All @@ -77,6 +80,7 @@ func CreateIRODSAccountForTicket(host string, port int, user string, zone string
Password: password,
Ticket: ticket,
DefaultResource: defaultResource,
DefaultHashScheme: HashSchemeDefault,
PamTTL: PamTTLDefault,
PamToken: "",
SSLConfiguration: nil,
Expand Down Expand Up @@ -104,6 +108,7 @@ func CreateIRODSProxyAccount(host string, port int, clientUser string, clientZon
Password: password,
Ticket: "",
DefaultResource: defaultResource,
DefaultHashScheme: HashSchemeDefault,
PamTTL: PamTTLDefault,
PamToken: "",
SSLConfiguration: nil,
Expand Down Expand Up @@ -164,6 +169,11 @@ func CreateIRODSAccountFromYAML(yamlBytes []byte) (*IRODSAccount, error) {
defaultResource = val.(string)
}

defaultHashScheme := ""
if val, ok := y["default_hash_scheme"]; ok {
defaultHashScheme = val.(string)
}

// proxy user
proxyUser := make(map[string]interface{})
if val, ok := y["proxy_user"]; ok {
Expand Down Expand Up @@ -310,6 +320,7 @@ func CreateIRODSAccountFromYAML(yamlBytes []byte) (*IRODSAccount, error) {
Password: proxyPassword,
Ticket: ticket,
DefaultResource: defaultResource,
DefaultHashScheme: defaultHashScheme,
PamTTL: pamTTL,
PamToken: pamToken,
SSLConfiguration: irodsSSLConfig,
Expand Down

0 comments on commit 16fca4e

Please sign in to comment.