@@ -62,7 +62,7 @@ const (
|
|||||||
// Auth methods
|
// Auth methods
|
||||||
const (
|
const (
|
||||||
SSHAuthMethodNone byte = 0x00
|
SSHAuthMethodNone byte = 0x00
|
||||||
SSHAuthMethodPasspharse byte = 0x01
|
SSHAuthMethodPassphrase byte = 0x01
|
||||||
SSHAuthMethodPrivateKey byte = 0x02
|
SSHAuthMethodPrivateKey byte = 0x02
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ func (d *sshClient) buildAuthMethod(
|
|||||||
return nil
|
return nil
|
||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
case SSHAuthMethodPasspharse:
|
case SSHAuthMethodPassphrase:
|
||||||
return func(b []byte) []ssh.AuthMethod {
|
return func(b []byte) []ssh.AuthMethod {
|
||||||
return []ssh.AuthMethod{
|
return []ssh.AuthMethod{
|
||||||
ssh.PasswordCallback(func() (string, error) {
|
ssh.PasswordCallback(func() (string, error) {
|
||||||
@@ -218,13 +218,13 @@ func (d *sshClient) buildAuthMethod(
|
|||||||
return "", wErr
|
return "", wErr
|
||||||
}
|
}
|
||||||
|
|
||||||
passpharseBytes, passpharseReceived := <-d.credentialReceive
|
passphraseBytes, passphraseReceived := <-d.credentialReceive
|
||||||
|
|
||||||
if !passpharseReceived {
|
if !passphraseReceived {
|
||||||
return "", ErrSSHAuthCancelled
|
return "", ErrSSHAuthCancelled
|
||||||
}
|
}
|
||||||
|
|
||||||
return string(passpharseBytes), nil
|
return string(passphraseBytes), nil
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}, nil
|
}, nil
|
||||||
|
|||||||
@@ -240,17 +240,17 @@ function startApp(rootEl) {
|
|||||||
date: serverDate ? new Date(serverDate) : null
|
date: serverDate ? new Date(serverDate) : null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async submitAuth(passpharse) {
|
async submitAuth(passphrase) {
|
||||||
this.authErr = "";
|
this.authErr = "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let result = await this.doAuth(passpharse);
|
let result = await this.doAuth(passphrase);
|
||||||
|
|
||||||
switch (result.result) {
|
switch (result.result) {
|
||||||
case 200:
|
case 200:
|
||||||
this.socket = this.buildSocket(
|
this.socket = this.buildSocket(
|
||||||
{
|
{
|
||||||
data: passpharse,
|
data: passphrase,
|
||||||
fetch() {
|
fetch() {
|
||||||
return this.data;
|
return this.data;
|
||||||
}
|
}
|
||||||
@@ -262,7 +262,7 @@ function startApp(rootEl) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 403:
|
case 403:
|
||||||
this.authErr = "Authentication has failed. Wrong passpharse?";
|
this.authErr = "Authentication has failed. Wrong passphrase?";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
22
ui/auth.vue
22
ui/auth.vue
@@ -28,13 +28,13 @@
|
|||||||
<div
|
<div
|
||||||
class="field"
|
class="field"
|
||||||
:class="{
|
:class="{
|
||||||
error: passpharseErr.length > 0 || error.length > 0
|
error: passphraseErr.length > 0 || error.length > 0
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
Passpharse
|
Passphrase
|
||||||
|
|
||||||
<input
|
<input
|
||||||
v-model="passpharse"
|
v-model="passphrase"
|
||||||
v-focus="true"
|
v-focus="true"
|
||||||
:disabled="submitting"
|
:disabled="submitting"
|
||||||
type="password"
|
type="password"
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="passpharseErr.length <= 0 && error.length <= 0"
|
v-if="passphraseErr.length <= 0 && error.length <= 0"
|
||||||
class="message"
|
class="message"
|
||||||
>
|
>
|
||||||
A valid password is required in order to use this
|
A valid password is required in order to use this
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
instance
|
instance
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="error">
|
<div v-else class="error">
|
||||||
{{ passpharseErr || error }}
|
{{ passphraseErr || error }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -91,8 +91,8 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
submitting: false,
|
submitting: false,
|
||||||
passpharse: "",
|
passphrase: "",
|
||||||
passpharseErr: ""
|
passphraseErr: ""
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -105,8 +105,8 @@ export default {
|
|||||||
mounted() {},
|
mounted() {},
|
||||||
methods: {
|
methods: {
|
||||||
auth() {
|
auth() {
|
||||||
if (this.passpharse.length <= 0) {
|
if (this.passphrase.length <= 0) {
|
||||||
this.passpharseErr = "Passpharse cannot be empty";
|
this.passphraseErr = "Passphrase cannot be empty";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -117,9 +117,9 @@ export default {
|
|||||||
|
|
||||||
this.submitting = true;
|
this.submitting = true;
|
||||||
|
|
||||||
this.passpharseErr = "";
|
this.passphraseErr = "";
|
||||||
|
|
||||||
this.$emit("auth", this.passpharse);
|
this.$emit("auth", this.passphrase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import * as strings from "./string.js";
|
|||||||
import Exception from "./exception.js";
|
import Exception from "./exception.js";
|
||||||
|
|
||||||
const AUTHMETHOD_NONE = 0x01;
|
const AUTHMETHOD_NONE = 0x01;
|
||||||
const AUTHMETHOD_PASSPHARSE = 0x01;
|
const AUTHMETHOD_PASSPHRASE = 0x01;
|
||||||
const AUTHMETHOD_PRIVATE_KEY = 0x02;
|
const AUTHMETHOD_PRIVATE_KEY = 0x02;
|
||||||
|
|
||||||
const COMMAND_ID = 0x01;
|
const COMMAND_ID = 0x01;
|
||||||
@@ -301,15 +301,15 @@ const initialFieldDef = {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Passpharse: {
|
Passphrase: {
|
||||||
name: "Passpharse",
|
name: "Passphrase",
|
||||||
description: "",
|
description: "",
|
||||||
type: "password",
|
type: "password",
|
||||||
value: "",
|
value: "",
|
||||||
example: "----------",
|
example: "----------",
|
||||||
verify(d) {
|
verify(d) {
|
||||||
if (d.length <= 0) {
|
if (d.length <= 0) {
|
||||||
throw new Error("Passpharse must be specified");
|
throw new Error("Passphrase must be specified");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d.length > MAX_PASSWORD_LEN) {
|
if (d.length > MAX_PASSWORD_LEN) {
|
||||||
@@ -318,7 +318,7 @@ const initialFieldDef = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "We'll login with this passpharse";
|
return "We'll login with this passphrase";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Private Key": {
|
"Private Key": {
|
||||||
@@ -396,7 +396,7 @@ function getAuthMethodFromStr(d) {
|
|||||||
return AUTHMETHOD_NONE;
|
return AUTHMETHOD_NONE;
|
||||||
|
|
||||||
case "Password":
|
case "Password":
|
||||||
return AUTHMETHOD_PASSPHARSE;
|
return AUTHMETHOD_PASSPHRASE;
|
||||||
|
|
||||||
case "Private Key":
|
case "Private Key":
|
||||||
return AUTHMETHOD_PRIVATE_KEY;
|
return AUTHMETHOD_PRIVATE_KEY;
|
||||||
@@ -694,8 +694,8 @@ class Wizard {
|
|||||||
fieldName = "";
|
fieldName = "";
|
||||||
|
|
||||||
switch (config.auth) {
|
switch (config.auth) {
|
||||||
case AUTHMETHOD_PASSPHARSE:
|
case AUTHMETHOD_PASSPHRASE:
|
||||||
fieldName = "Passpharse";
|
fieldName = "Passphrase";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUTHMETHOD_PRIVATE_KEY:
|
case AUTHMETHOD_PRIVATE_KEY:
|
||||||
|
|||||||
Reference in New Issue
Block a user