46 changed files with 391 additions and 388 deletions
@ -0,0 +1,85 @@ |
|||||
|
<template> |
||||
|
<w-dialog |
||||
|
ref="changePasswordDialogRef" |
||||
|
width="400px" |
||||
|
height="300px" |
||||
|
:title="$t('changePassword')" |
||||
|
:can-maximize="false" |
||||
|
:buttons="[ |
||||
|
{ |
||||
|
label: $t('submit'), |
||||
|
click: changePassword, |
||||
|
}, |
||||
|
]" |
||||
|
> |
||||
|
<w-form |
||||
|
ref="changePasswordFormRef" |
||||
|
:cols-num="1" |
||||
|
:fields="[ |
||||
|
{ |
||||
|
name: 'rawPassword', |
||||
|
label: $t('rawPassword'), |
||||
|
type: 'password', |
||||
|
requiredIf: () => { |
||||
|
return true; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'newPassword', |
||||
|
label: $t('newPassword'), |
||||
|
type: 'password', |
||||
|
requiredIf: () => { |
||||
|
return true; |
||||
|
}, |
||||
|
}, |
||||
|
{ |
||||
|
name: 'confirmNewPassword', |
||||
|
label: $t('confirmNewPassword'), |
||||
|
type: 'password', |
||||
|
requiredIf: () => { |
||||
|
return true; |
||||
|
}, |
||||
|
rules: [ |
||||
|
(val) => { |
||||
|
return changePasswordFormRef.data.newPassword != val ? $t('passwordAndConfirmPasswordMustEqual') : true; |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
]" |
||||
|
class="p-2" |
||||
|
></w-form> |
||||
|
</w-dialog> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue'; |
||||
|
import { useI18n } from 'vue-i18n'; |
||||
|
import { Environment } from '@/platform/plugin/environment'; |
||||
|
import { axios, NotifyManager } from '@/platform/plugin'; |
||||
|
|
||||
|
const { t } = useI18n(); |
||||
|
const changePasswordDialogRef = ref(); |
||||
|
const changePasswordFormRef = ref(); |
||||
|
|
||||
|
const changePassword = async () => { |
||||
|
const result = await changePasswordFormRef.value.validate(); |
||||
|
if (result) { |
||||
|
axios.post(Environment.apiContextPath('/api/system/user/changePassword'), changePasswordFormRef.value.getData()).then((response) => { |
||||
|
hide(); |
||||
|
NotifyManager.info(t('operationSuccess')); |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
const show = () => { |
||||
|
changePasswordDialogRef.value.show(); |
||||
|
}; |
||||
|
|
||||
|
const hide = () => { |
||||
|
changePasswordDialogRef.value.hide(); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
show, |
||||
|
hide, |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,22 @@ |
|||||
|
package io.sc.platform.core.exception; |
||||
|
|
||||
|
public class PlatformRuntimeException extends RuntimeException{ |
||||
|
public PlatformRuntimeException() { |
||||
|
} |
||||
|
|
||||
|
public PlatformRuntimeException(String message) { |
||||
|
super(message); |
||||
|
} |
||||
|
|
||||
|
public PlatformRuntimeException(String message, Throwable cause) { |
||||
|
super(message, cause); |
||||
|
} |
||||
|
|
||||
|
public PlatformRuntimeException(Throwable cause) { |
||||
|
super(cause); |
||||
|
} |
||||
|
|
||||
|
public PlatformRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { |
||||
|
super(message, cause, enableSuppression, writableStackTrace); |
||||
|
} |
||||
|
} |
@ -1,154 +0,0 @@ |
|||||
package io.sc.platform.security.oauth2.server.authorization.configure.support; |
|
||||
|
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
|
||||
|
|
||||
@ConfigurationProperties("platform.security") |
|
||||
public class PlatformSecurityProperties { |
|
||||
private String userInfoUrl ="/api/user-info"; |
|
||||
private final FormLogin formLogin = new FormLogin(); |
|
||||
private final Logout logout = new Logout(); |
|
||||
private final Oauth2 oauth2 = new Oauth2(); |
|
||||
private final Rsa rsa = new Rsa(); |
|
||||
|
|
||||
public String getUserInfoUrl() { |
|
||||
return userInfoUrl; |
|
||||
} |
|
||||
|
|
||||
public void setUserInfoUrl(String userInfoUrl) { |
|
||||
this.userInfoUrl = userInfoUrl; |
|
||||
} |
|
||||
|
|
||||
public FormLogin getFormLogin() { |
|
||||
return formLogin; |
|
||||
} |
|
||||
|
|
||||
public Logout getLogout() { |
|
||||
return logout; |
|
||||
} |
|
||||
|
|
||||
public Oauth2 getOauth2() { |
|
||||
return oauth2; |
|
||||
} |
|
||||
|
|
||||
public Rsa getRsa() { |
|
||||
return rsa; |
|
||||
} |
|
||||
|
|
||||
public static class FormLogin { |
|
||||
private String loginPage ="/login"; |
|
||||
private String loginProcessingUrl ="/login"; |
|
||||
private String failureUrl ="/login?error"; |
|
||||
|
|
||||
public String getLoginPage() { |
|
||||
return loginPage; |
|
||||
} |
|
||||
|
|
||||
public void setLoginPage(String loginPage) { |
|
||||
this.loginPage = loginPage; |
|
||||
} |
|
||||
|
|
||||
public String getLoginProcessingUrl() { |
|
||||
return loginProcessingUrl; |
|
||||
} |
|
||||
|
|
||||
public void setLoginProcessingUrl(String loginProcessingUrl) { |
|
||||
this.loginProcessingUrl = loginProcessingUrl; |
|
||||
} |
|
||||
|
|
||||
public String getFailureUrl() { |
|
||||
return failureUrl; |
|
||||
} |
|
||||
|
|
||||
public void setFailureUrl(String failureUrl) { |
|
||||
this.failureUrl = failureUrl; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public static class Logout { |
|
||||
private String logoutUrl ="/oauth2/logout"; |
|
||||
private String logoutSuccessUrl ="/"; |
|
||||
|
|
||||
public String getLogoutUrl() { |
|
||||
return logoutUrl; |
|
||||
} |
|
||||
|
|
||||
public void setLogoutUrl(String logoutUrl) { |
|
||||
this.logoutUrl = logoutUrl; |
|
||||
} |
|
||||
|
|
||||
public String getLogoutSuccessUrl() { |
|
||||
return logoutSuccessUrl; |
|
||||
} |
|
||||
|
|
||||
public void setLogoutSuccessUrl(String logoutSuccessUrl) { |
|
||||
this.logoutSuccessUrl = logoutSuccessUrl; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public static class Oauth2 { |
|
||||
private final AuthorizationServer authorizationServer =new AuthorizationServer(); |
|
||||
|
|
||||
public AuthorizationServer getAuthorizationServer() { |
|
||||
return authorizationServer; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public static class AuthorizationServer { |
|
||||
private String issuerUri ="http://localhost:8080"; |
|
||||
private String jwkKeyId ="io.sc.platform.security.oauth2.server.keyId"; |
|
||||
private final RedirectUriValidator redirectUriValidator = new RedirectUriValidator(); |
|
||||
|
|
||||
public String getIssuerUri() { |
|
||||
return issuerUri; |
|
||||
} |
|
||||
|
|
||||
public void setIssuerUri(String issuerUri) { |
|
||||
this.issuerUri = issuerUri; |
|
||||
} |
|
||||
|
|
||||
public String getJwkKeyId() { |
|
||||
return jwkKeyId; |
|
||||
} |
|
||||
|
|
||||
public void setJwkKeyId(String jwkKeyId) { |
|
||||
this.jwkKeyId = jwkKeyId; |
|
||||
} |
|
||||
|
|
||||
public RedirectUriValidator getRedirectUriValidator() { |
|
||||
return redirectUriValidator; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public static class RedirectUriValidator { |
|
||||
private boolean enable =true; |
|
||||
|
|
||||
public boolean isEnable() { |
|
||||
return enable; |
|
||||
} |
|
||||
|
|
||||
public void setEnable(boolean enable) { |
|
||||
this.enable = enable; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public static class Rsa { |
|
||||
private String publicKeyLocation ="classpath:/io/sc/platform/security/publicKey.txt"; |
|
||||
private String privateKeyLocation ="classpath:/io/sc/platform/security/privateKey.txt"; |
|
||||
|
|
||||
public String getPublicKeyLocation() { |
|
||||
return publicKeyLocation; |
|
||||
} |
|
||||
|
|
||||
public void setPublicKeyLocation(String publicKeyLocation) { |
|
||||
this.publicKeyLocation = publicKeyLocation; |
|
||||
} |
|
||||
|
|
||||
public String getPrivateKeyLocation() { |
|
||||
return privateKeyLocation; |
|
||||
} |
|
||||
|
|
||||
public void setPrivateKeyLocation(String privateKeyLocation) { |
|
||||
this.privateKeyLocation = privateKeyLocation; |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -1,4 +1,4 @@ |
|||||
package io.sc.platform.security.support; |
package io.sc.platform.security; |
||||
|
|
||||
public class SecurityClaimNames { |
public class SecurityClaimNames { |
||||
public static final class User { |
public static final class User { |
@ -1,4 +1,4 @@ |
|||||
package io.sc.platform.security.support; |
package io.sc.platform.security; |
||||
|
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties; |
import org.springframework.boot.context.properties.ConfigurationProperties; |
||||
|
|
@ -1,86 +0,0 @@ |
|||||
<template> |
|
||||
<div> |
|
||||
<q-dialog ref="dialogRef" allow-focus-outside v-bind="attrs"> |
|
||||
<q-card |
|
||||
:style="{ |
|
||||
width: attrs.maximized ? '100vw' : width, |
|
||||
'max-width': '100vw', |
|
||||
height: attrs.maximized ? '100vh' : height, |
|
||||
'max-height': '100vh', |
|
||||
}" |
|
||||
> |
|
||||
<q-card-section :style="headerStyle"> |
|
||||
<div class="flex justify-between"> |
|
||||
<div class="text-h6">{{ title }}</div> |
|
||||
<div class="flex justify-end q-gutter-md"> |
|
||||
<q-btn v-close-popup dense flat icon="close" :title="$t('close')"> </q-btn> |
|
||||
</div> |
|
||||
</div> |
|
||||
</q-card-section> |
|
||||
<q-card-section class="q-pt-md" :style="bodyStyle"> |
|
||||
<div class="row"> |
|
||||
<div class="col-12"> |
|
||||
<q-input v-model="model.rawPassword" type="password" label="原密码" outlined autocomplete="false" class="p-1" /> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="row"> |
|
||||
<div class="col-12"> |
|
||||
<q-input v-model="model.newPassword" type="password" label="新密码" outlined autocomplete="false" class="p-1" /> |
|
||||
</div> |
|
||||
</div> |
|
||||
<div class="row"> |
|
||||
<div class="col-12"> |
|
||||
<q-input v-model="model.confirmNewPassword" type="password" label="确认新密码" outlined autocomplete="false" class="p-1" /> |
|
||||
</div> |
|
||||
</div> |
|
||||
</q-card-section> |
|
||||
<q-card-section class="row justify-center items-start content-start q-gutter-md"> |
|
||||
<q-btn :label="$t('confirm')" color="primary" style="width: 100px" @click="changePassword" /> |
|
||||
<q-btn :label="$t('cancel')" style="width: 100px" @click="dialogRef.hide" /> |
|
||||
</q-card-section> |
|
||||
</q-card> |
|
||||
</q-dialog> |
|
||||
</div> |
|
||||
</template> |
|
||||
<script setup lang="ts"> |
|
||||
import { useAttrs, ref, reactive, toRaw } from 'vue'; |
|
||||
import { useI18n } from 'vue-i18n'; |
|
||||
import { axios, Environment } from 'platform-core'; |
|
||||
|
|
||||
const attrs = useAttrs(); |
|
||||
|
|
||||
const props = defineProps({ |
|
||||
headerStyle: { type: String, default: 'width:100%;padding: 16px 8px 4px 16px' }, |
|
||||
bodyStyle: { type: String, default: 'padding: 0px 8px 0px 8px;height:200px' }, |
|
||||
title: { type: String, default: '' }, |
|
||||
width: { type: String, default: '70%' }, |
|
||||
height: { type: String, default: '70%' }, |
|
||||
}); |
|
||||
|
|
||||
const { t } = useI18n(); |
|
||||
const dialogRef = ref(); |
|
||||
const model = reactive({ |
|
||||
rawPassword: '', |
|
||||
newPassword: '', |
|
||||
confirmNewPassword: '', |
|
||||
}); |
|
||||
|
|
||||
const changePassword = () => { |
|
||||
axios.post(Environment.apiContextPath('/api/system/user/changePassword'), toRaw(model)).then(() => { |
|
||||
dialogRef.value.hide(); |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const show = (param: object) => { |
|
||||
dialogRef.value.show(); |
|
||||
}; |
|
||||
|
|
||||
const hide = () => { |
|
||||
dialogRef.value.hide(); |
|
||||
}; |
|
||||
|
|
||||
defineExpose({ |
|
||||
show, |
|
||||
hide, |
|
||||
}); |
|
||||
</script> |
|
@ -0,0 +1,59 @@ |
|||||
|
<template> |
||||
|
<w-dialog |
||||
|
ref="setPasswordDialogRef" |
||||
|
:title="$t('system.user.action.' + actionType)" |
||||
|
width="500px" |
||||
|
height="200px" |
||||
|
:can-maximize="false" |
||||
|
:buttons="[ |
||||
|
{ |
||||
|
label: $t('submit'), |
||||
|
click: () => { |
||||
|
axios |
||||
|
.post(Environment.apiContextPath('/api/system/user/' + actionType), { |
||||
|
userIds: userIds, |
||||
|
password: setPasswordFormRef.getData().password, |
||||
|
}) |
||||
|
.then(() => { |
||||
|
setPasswordDialogRef.hide(); |
||||
|
NotifyManager.info($t('operationSuccess')); |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
]" |
||||
|
> |
||||
|
<w-form |
||||
|
ref="setPasswordFormRef" |
||||
|
:cols-num="1" |
||||
|
:fields="[ |
||||
|
{ name: 'password', label: $t('password'), type: 'password' }, |
||||
|
{ name: 'confirmPassword', label: $t('confirmPassword'), type: 'password' }, |
||||
|
]" |
||||
|
class="p-2" |
||||
|
></w-form> |
||||
|
</w-dialog> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref } from 'vue'; |
||||
|
import { axios, Environment, NotifyManager, Tools } from 'platform-core'; |
||||
|
|
||||
|
const setPasswordDialogRef = ref(); |
||||
|
const setPasswordFormRef = ref(); |
||||
|
let actionType = ref(); |
||||
|
let userIds = []; |
||||
|
|
||||
|
const show = (type, users) => { |
||||
|
actionType.value = type; |
||||
|
userIds = Tools.extractProperties(users, 'id'); |
||||
|
setPasswordDialogRef.value.show(); |
||||
|
}; |
||||
|
|
||||
|
const hide = () => { |
||||
|
setPasswordDialogRef.value.hide(); |
||||
|
}; |
||||
|
|
||||
|
defineExpose({ |
||||
|
show, |
||||
|
hide, |
||||
|
}); |
||||
|
</script> |
Loading…
Reference in new issue