샘플 프로젝트 인증 구현
This commit is contained in:
@@ -7,7 +7,7 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.gsitm.ustra.java.starter:ustra-starter-vue-bo:2.0.19.RELEASE'
|
compile 'com.gsitm.ustra.java.starter:ustra-starter-vue-bo:2.0.24.RELEASE'
|
||||||
compile project(":cmm")
|
compile project(":cmm")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.gsitm.ustra.java.starter:ustra-starter-vue-front:2.0.19.RELEASE'
|
compile 'com.gsitm.ustra.java.starter:ustra-starter-restapi:2.0.24.RELEASE'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,16 +7,11 @@ repositories {
|
|||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.gsitm.ustra.java.starter:ustra-starter-vue-front:2.0.19.RELEASE'
|
compile 'com.gsitm.ustra.java.starter:ustra-starter-restapi:2.0.24.RELEASE'
|
||||||
|
compile 'com.gsitm.ustra.java:ustra-mvc-view:2.0.24.RELEASE'
|
||||||
|
compile 'com.gsitm.ustra.java:ustra-data-mybatis:2.0.24.RELEASE'
|
||||||
|
compile 'com.gsitm.ustra.java:ustra-security-jwt:2.0.24.RELEASE'
|
||||||
compile project(":cmm")
|
compile project(":cmm")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task shadowJar {
|
|
||||||
|
|
||||||
dependsOn 'jar'
|
|
||||||
doLast {
|
|
||||||
delete fileTree(dir: "build", exclude: "libs")
|
|
||||||
delete fileTree(dir: "build/libs", exclude: "*.jar")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2,25 +2,38 @@ package sample.ustraframework.java.fo.config;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.cache.Cache;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
|
||||||
import com.gsitm.ustra.java.security.authentication.UstraAuthenticationConfigurer;
|
import com.gsitm.ustra.java.core.cache.UstraCacheManagerSupport;
|
||||||
import com.gsitm.ustra.java.security.authentication.authentication.UstraAuthentication;
|
|
||||||
import com.gsitm.ustra.java.security.authentication.processor.DefaultUstraAuthenticationProcessor;
|
|
||||||
import com.gsitm.ustra.java.security.authentication.processor.UstraAuthenticationProcessor;
|
import com.gsitm.ustra.java.security.authentication.processor.UstraAuthenticationProcessor;
|
||||||
import com.gsitm.ustra.java.security.authentication.request.token.UserNamePasswordAuthenticationRequestToken;
|
import com.gsitm.ustra.java.security.authentication.properties.UstraAuthenticationProperties;
|
||||||
import com.gsitm.ustra.java.security.authentication.user.UstraAnonymousUser;
|
import com.gsitm.ustra.java.security.authentication.request.token.UstraAuthenticationRequestToken;
|
||||||
|
import com.gsitm.ustra.java.security.authentication.user.UstraCachedUserDetailProvider;
|
||||||
import com.gsitm.ustra.java.security.authentication.user.UstraUser;
|
import com.gsitm.ustra.java.security.authentication.user.UstraUser;
|
||||||
import com.gsitm.ustra.java.security.authentication.user.UstraUserDetailProvider;
|
import com.gsitm.ustra.java.security.authentication.user.UstraUserDetailProvider;
|
||||||
|
import com.gsitm.ustra.java.security.authentication.user.checker.UstraUserDetailChecker;
|
||||||
import com.gsitm.ustra.java.security.config.UstraSecurityConfigure;
|
import com.gsitm.ustra.java.security.config.UstraSecurityConfigure;
|
||||||
|
import com.gsitm.ustra.java.security.jwt.authentication.UstraJwtAuthenticationConfigurer;
|
||||||
|
import com.gsitm.ustra.java.security.jwt.authentication.authentication.UstraJwtAuthentication;
|
||||||
|
import com.gsitm.ustra.java.security.jwt.authentication.claims.DefaultUstraJwtClaimAppender;
|
||||||
|
import com.gsitm.ustra.java.security.jwt.authentication.claims.UstraJwtClaimAppender;
|
||||||
|
import com.gsitm.ustra.java.security.jwt.authentication.claims.UstraJwtClaims;
|
||||||
|
import com.gsitm.ustra.java.security.jwt.authentication.processor.UstraJwtAuthenticationProcessor;
|
||||||
|
|
||||||
|
import sample.ustraframework.java.fo.config.auth.SampleUser;
|
||||||
|
import sample.ustraframework.java.fo.sample.SampleAppProperties;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableConfigurationProperties({ SampleAppProperties.class } )
|
||||||
public class AuthenticationConfiguration {
|
public class AuthenticationConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
UstraSecurityConfigure securityConfigure() {
|
UstraSecurityConfigure customSecurityConfigure() {
|
||||||
return new UstraSecurityConfigure() {
|
return new UstraSecurityConfigure() {
|
||||||
@Override
|
@Override
|
||||||
public void postConfigure(WebSecurity web) throws Exception {
|
public void postConfigure(WebSecurity web) throws Exception {
|
||||||
@@ -30,33 +43,87 @@ public class AuthenticationConfiguration {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
UstraAuthenticationProcessor<UserNamePasswordAuthenticationRequestToken, UstraAuthentication> authenticationProcessor() {
|
UstraCachedUserDetailProvider<UstraAuthenticationRequestToken, UstraJwtAuthentication, UstraUser> userDetailProvider() {
|
||||||
|
return new UstraCachedUserDetailProvider<UstraAuthenticationRequestToken, UstraJwtAuthentication, UstraUser>(UstraUser.class) {
|
||||||
|
|
||||||
return new DefaultUstraAuthenticationProcessor<>(
|
@Override
|
||||||
new UstraAuthenticationConfigurer<UserNamePasswordAuthenticationRequestToken, UstraAuthentication>() {
|
protected UstraUser getInternalUserDetails(UstraAuthenticationRequestToken authenticationRequestToken) {
|
||||||
|
SampleUser user = new SampleUser("sample", new ArrayList<>());
|
||||||
|
|
||||||
public UstraUserDetailProvider<UserNamePasswordAuthenticationRequestToken,UstraAuthentication> userDetailProvider(
|
// TODO: 패스워드 비교 등.
|
||||||
UstraAuthenticationProcessor<UserNamePasswordAuthenticationRequestToken, UstraAuthentication> processor) {
|
user.setDisplayName("샘플사용자");
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
return new UstraUserDetailProvider<UserNamePasswordAuthenticationRequestToken, UstraAuthentication>() {
|
@Override
|
||||||
|
protected UstraUser getInternalUserDetails(UstraJwtAuthentication authentication) {
|
||||||
|
SampleUser user = new SampleUser("sample", new ArrayList<>());
|
||||||
|
// TODO: 패스워드 비교 등.
|
||||||
|
user.setDisplayName("샘플사용자");
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Cache getCache() {
|
||||||
|
return UstraCacheManagerSupport.getCache("authentication");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
UstraJwtAuthenticationProcessor<UstraAuthenticationRequestToken, UstraJwtAuthentication> authenticationProcessor(
|
||||||
|
SampleAppProperties sampleAppProperties,
|
||||||
|
UstraUserDetailProvider<UstraAuthenticationRequestToken,UstraJwtAuthentication> userDetailProvider) {
|
||||||
|
|
||||||
|
return new UstraJwtAuthenticationProcessor<>(
|
||||||
|
new UstraJwtAuthenticationConfigurer<UstraAuthenticationRequestToken, UstraJwtAuthentication>() {
|
||||||
|
|
||||||
|
public UstraAuthenticationProperties authenticationProperties(
|
||||||
|
UstraAuthenticationProcessor<UstraAuthenticationRequestToken,UstraJwtAuthentication> processor) {
|
||||||
|
return sampleAppProperties.getAuthentication();
|
||||||
|
};
|
||||||
|
|
||||||
|
public UstraUserDetailProvider<UstraAuthenticationRequestToken,UstraJwtAuthentication> userDetailProvider(
|
||||||
|
UstraAuthenticationProcessor<UstraAuthenticationRequestToken, UstraJwtAuthentication> processor) {
|
||||||
|
return userDetailProvider;
|
||||||
|
};
|
||||||
|
|
||||||
|
public UstraUserDetailChecker<UstraAuthenticationRequestToken> userDetailChecker(
|
||||||
|
UstraAuthenticationProcessor<UstraAuthenticationRequestToken,UstraJwtAuthentication> processor) {
|
||||||
|
return new UstraUserDetailChecker<UstraAuthenticationRequestToken>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UstraUser getUserDetails(
|
public void check(UstraAuthenticationRequestToken requestToken, UstraUser userDetails) {
|
||||||
UserNamePasswordAuthenticationRequestToken authenticationRequestToken) {
|
|
||||||
|
|
||||||
return new UstraAnonymousUser(new ArrayList<>());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public UstraUser getUserDetails(UstraAuthentication authentication) {
|
|
||||||
|
|
||||||
return new UstraAnonymousUser(new ArrayList<>());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public UstraJwtClaimAppender jwtClaimAppender(
|
||||||
|
UstraAuthenticationProcessor<UstraAuthenticationRequestToken,UstraJwtAuthentication> processor) {
|
||||||
|
|
||||||
|
return new DefaultUstraJwtClaimAppender() {
|
||||||
|
@Override
|
||||||
|
public void append(UstraJwtClaims claims, Authentication authentication) {
|
||||||
|
super.append(claims, authentication);
|
||||||
|
|
||||||
|
if (authentication.getDetails() != null && authentication.getDetails() instanceof SampleUser) {
|
||||||
|
SampleUser user = (SampleUser)authentication.getDetails();
|
||||||
|
claims.getClaims().put("displayName", user.getDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
}
|
}
|
||||||
, UstraAuthentication.class);
|
, UstraJwtAuthentication.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package sample.ustraframework.java.fo.config.auth;
|
package sample.ustraframework.java.fo.config.auth;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
|
||||||
import com.gsitm.ustra.java.security.authentication.user.UstraUser;
|
import com.gsitm.ustra.java.security.authentication.user.UstraUser;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -14,6 +18,7 @@ public class SampleUser extends UstraUser {
|
|||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -6807776765213734147L;
|
private static final long serialVersionUID = -6807776765213734147L;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 사용자 표시 명
|
* 사용자 표시 명
|
||||||
*/
|
*/
|
||||||
@@ -23,4 +28,14 @@ public class SampleUser extends UstraUser {
|
|||||||
super(username);
|
super(username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SampleUser(String username, Collection<? extends GrantedAuthority> authorities) {
|
||||||
|
super(username, authorities);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SampleUser(String username, String password, boolean enabled, boolean accountNonExpired,
|
||||||
|
boolean credentialsNonExpired, boolean accountNonLocked,
|
||||||
|
Collection<? extends GrantedAuthority> authorities) {
|
||||||
|
super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
//package sample.ustraframework.java.fo.config.auth;
|
|
||||||
//
|
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
//
|
|
||||||
//import com.gsitm.ustra.java.security.authentication.request.token.UserNamePasswordAuthenticationRequestToken;
|
|
||||||
//import com.gsitm.ustra.java.security.authentication.request.token.UstraAuthenticationRequestToken;
|
|
||||||
//import com.gsitm.ustra.java.security.authentication.user.UstraUser;
|
|
||||||
//import com.gsitm.ustra.java.security.authentication.user.UstraUserDetailProvider;
|
|
||||||
//import com.gsitm.ustra.java.security.jwt.authentication.authentication.UstraJwtAuthentication;
|
|
||||||
//
|
|
||||||
//import sample.ustraframework.java.fo.sample.user.UserModel;
|
|
||||||
//import sample.ustraframework.java.fo.sample.user.UserService;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 사용자 정보 조회
|
|
||||||
// *
|
|
||||||
// */
|
|
||||||
//public class SampleUserDetailProvider implements UstraUserDetailProvider<UstraAuthenticationRequestToken, UstraJwtAuthentication> {
|
|
||||||
//
|
|
||||||
// @Autowired private UserService userService;
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public UstraUser getUserDetails(UstraAuthenticationRequestToken authenticationRequestToken) {
|
|
||||||
//
|
|
||||||
// if (authenticationRequestToken instanceof UserNamePasswordAuthenticationRequestToken) {
|
|
||||||
//
|
|
||||||
// UserNamePasswordAuthenticationRequestToken requestToken = (UserNamePasswordAuthenticationRequestToken)authenticationRequestToken;
|
|
||||||
// userService.getUserByIdPassword(requestToken.getUserName(), requestToken.getPassword());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public UstraUser getUserDetails(UstraJwtAuthentication authentication) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// private SampleUser getUser(String usrId) {
|
|
||||||
// UserModel userModel = userService.getUserById(usrId);
|
|
||||||
//
|
|
||||||
// if (userModel == null) {
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// SampleUser user = new SampleUser(userModel.getUsrId());
|
|
||||||
// user.setDisplayName(userModel.getUsrNm());
|
|
||||||
//
|
|
||||||
// return user;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package sample.ustraframework.java.fo.sample;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
import com.gsitm.ustra.java.security.jwt.authentication.properties.UstraJwtAuthenticationProperties;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = SampleAppProperties.PREFIX, ignoreInvalidFields = true, ignoreUnknownFields = true)
|
||||||
|
public class SampleAppProperties {
|
||||||
|
|
||||||
|
public static final String PREFIX = "ustra.sample";
|
||||||
|
|
||||||
|
|
||||||
|
private UstraJwtAuthenticationProperties authentication;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package sample.ustraframework.java.fo.sample.auth;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.gsitm.ustra.java.security.authentication.authentication.UstraAuthentication;
|
||||||
|
import com.gsitm.ustra.java.security.authentication.request.token.UserNamePasswordAuthenticationRequestToken;
|
||||||
|
import com.gsitm.ustra.java.security.jwt.authentication.UstraJwtAuthenticationManager;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class AuthenticationController {
|
||||||
|
|
||||||
|
@Autowired UstraJwtAuthenticationManager authenticationManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 로그인 처리
|
||||||
|
* @param token
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@PostMapping("/api/auth/login")
|
||||||
|
public UstraAuthentication login(@RequestBody UserNamePasswordAuthenticationRequestToken token) throws Exception {
|
||||||
|
return authenticationManager.authenticate(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 로그아웃 처리
|
||||||
|
*/
|
||||||
|
@PostMapping("/api/auth/logout")
|
||||||
|
public void logout() {
|
||||||
|
authenticationManager.unAuthenticate(authenticationManager.getAuthentication());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,8 +3,6 @@ package sample.ustraframework.java.fo.sample.user;
|
|||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
import com.gsitm.ustra.java.management.models.base.UstraManagementBaseModel;
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -13,7 +11,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class UserModel extends UstraManagementBaseModel {
|
public class UserModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 사용자 아이디
|
* 사용자 아이디
|
||||||
|
|||||||
@@ -13,6 +13,14 @@ mybatis:
|
|||||||
jdbc-type-for-null: "NULL"
|
jdbc-type-for-null: "NULL"
|
||||||
|
|
||||||
ustra:
|
ustra:
|
||||||
|
core:
|
||||||
|
cache:
|
||||||
|
caffeine:
|
||||||
|
authentication:
|
||||||
|
maximum-size: 200 # 최대적재사이즈
|
||||||
|
initial-capacity: 100 # 초기사이즈
|
||||||
|
expire-after-write-seconds: 1800 # 캐시 적재 후 제거될 초수
|
||||||
|
expire-after-access-seconds: 1800 # 캐시 조회 후 제거될 초수
|
||||||
data:
|
data:
|
||||||
file:
|
file:
|
||||||
enabled: false
|
enabled: false
|
||||||
@@ -30,4 +38,12 @@ ustra:
|
|||||||
view:
|
view:
|
||||||
api-prefix: api
|
api-prefix: api
|
||||||
client-crypto-key: Z3NjLWNyeXB0by1rZXkxMQ==
|
client-crypto-key: Z3NjLWNyeXB0by1rZXkxMQ==
|
||||||
type: STATIC_THYEMELEAF
|
type: STATIC_THYEMELEAF
|
||||||
|
|
||||||
|
sample:
|
||||||
|
authentication:
|
||||||
|
secret-key: zjajhz829110y
|
||||||
|
token-key: sample-fo-token
|
||||||
|
enable-refresh-token: false
|
||||||
|
access-valid-second: 1800
|
||||||
|
allow-anonymous-authentication: true
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
"test": "jest --detectOpenHandles --forceExit"
|
"test": "jest --detectOpenHandles --forceExit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ustra/nuxt": "^2.0.19-stable",
|
"@ustra/nuxt": "^2.0.23-stable",
|
||||||
"@ustra/nuxt-dx-mng-bo": "^2.0.19-stable",
|
"@ustra/nuxt-dx-mng-bo": "^2.0.23-stable",
|
||||||
"@ustra/nuxt-mng-bo": "^2.0.19-stable",
|
"@ustra/nuxt-mng-bo": "^2.0.23-stable",
|
||||||
"@ustra-sample/cmm": "1.0.0"
|
"@ustra-sample/cmm": "1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,6 @@
|
|||||||
"test": "jest --detectOpenHandles --forceExit"
|
"test": "jest --detectOpenHandles --forceExit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ustra/nuxt": "^2.0.19-stable"
|
"@ustra/nuxt": "^2.0.23-stable"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3
front/fo/client/assets/global.scss
Normal file
3
front/fo/client/assets/global.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.sub-page-section {
|
||||||
|
padding: 50px 0;
|
||||||
|
}
|
||||||
@@ -1,9 +1,20 @@
|
|||||||
import { Component } from 'vue-property-decorator'
|
import { Component } from 'vue-property-decorator'
|
||||||
import { UstraComponent } from '@ustra/nuxt/src/vue/components/ustra-component'
|
import { UstraComponent } from '@ustra/nuxt/src/vue/components/ustra-component'
|
||||||
|
import { HttpMethod } from '@ustra/core/src/server/http/const'
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default class CustomFoComponent extends UstraComponent {
|
export default class CustomFoComponent extends UstraComponent {
|
||||||
mounted() {}
|
mounted() {}
|
||||||
|
|
||||||
|
async logout() {
|
||||||
|
await this.$ustra.api.call({
|
||||||
|
url: '/api/auth/logout',
|
||||||
|
method: HttpMethod.POST,
|
||||||
|
})
|
||||||
|
await this.$ustra.auth.logout(false, true)
|
||||||
|
|
||||||
|
this.$router.push('/')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { CustomFoComponent }
|
export { CustomFoComponent }
|
||||||
|
|||||||
@@ -9,17 +9,12 @@
|
|||||||
<template #start>
|
<template #start>
|
||||||
<b-navbar-item :active="isActiveHome" type="div" @click="goHome">Home</b-navbar-item>
|
<b-navbar-item :active="isActiveHome" type="div" @click="goHome">Home</b-navbar-item>
|
||||||
<b-navbar-item :active="isActiveIntroduce" @click="$router.push('/introduce')">Introduce</b-navbar-item>
|
<b-navbar-item :active="isActiveIntroduce" @click="$router.push('/introduce')">Introduce</b-navbar-item>
|
||||||
|
<b-navbar-item :active="isActiveCustomer" @click="$router.push('/customer')">Customer</b-navbar-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #end>
|
<template #end>
|
||||||
<b-navbar-item tag="div">
|
<b-navbar-item v-show="!isAuthenticated" @click="$router.push('/customer')">Login</b-navbar-item>
|
||||||
<div class="buttons">
|
<b-navbar-item v-show="isAuthenticated" @click="logout">Logout</b-navbar-item>
|
||||||
<!-- <a class="button is-primary">
|
|
||||||
<strong>Sign up</strong>
|
|
||||||
</a>
|
|
||||||
<a class="button is-light" @click="signIn"> Sign in </a> -->
|
|
||||||
</div>
|
|
||||||
</b-navbar-item>
|
|
||||||
</template>
|
</template>
|
||||||
</b-navbar>
|
</b-navbar>
|
||||||
</template>
|
</template>
|
||||||
@@ -39,6 +34,14 @@ export default class extends CustomFoComponent {
|
|||||||
return startsWith(this.$route.path, '/introduce')
|
return startsWith(this.$route.path, '/introduce')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isActiveCustomer() {
|
||||||
|
return startsWith(this.$route.path, '/customer')
|
||||||
|
}
|
||||||
|
|
||||||
|
get isAuthenticated() {
|
||||||
|
return this.$ustra.auth.isAutenticated()
|
||||||
|
}
|
||||||
|
|
||||||
// #endregion
|
// #endregion
|
||||||
// #region hooks
|
// #region hooks
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|||||||
@@ -30,4 +30,4 @@ export default class extends CustomFoComponent {
|
|||||||
// #endregion
|
// #endregion
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss"></style>
|
<style lang="scss"></style>
|
||||||
|
|||||||
47
front/fo/client/pages/customer/index.vue
Normal file
47
front/fo/client/pages/customer/index.vue
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<template>
|
||||||
|
<section class="sub-page-section">
|
||||||
|
<div class="box" style="margin: 0 200px">
|
||||||
|
<b-field label="Name">
|
||||||
|
<b-input v-model="userName"></b-input>
|
||||||
|
</b-field>
|
||||||
|
|
||||||
|
<b-field label="Password">
|
||||||
|
<b-input type="password" v-model="password" password-reveal> </b-input>
|
||||||
|
</b-field>
|
||||||
|
|
||||||
|
<b-button type="is-primary" @click="login">Login</b-button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { Component } from 'vue-property-decorator'
|
||||||
|
import { CustomFoComponent } from '@/components/custom-fo-component'
|
||||||
|
import { HttpMethod } from '@ustra/core/src/server/http/const'
|
||||||
|
|
||||||
|
@Component
|
||||||
|
export default class extends CustomFoComponent {
|
||||||
|
// #region variables
|
||||||
|
userName = null
|
||||||
|
password = null
|
||||||
|
// #endregion
|
||||||
|
// #region hooks
|
||||||
|
// #endregion
|
||||||
|
// #region methods
|
||||||
|
async login() {
|
||||||
|
await this.$ustra.api.call({
|
||||||
|
url: '/api/auth/login',
|
||||||
|
method: HttpMethod.POST,
|
||||||
|
data: {
|
||||||
|
userName: this.userName,
|
||||||
|
password: this.password,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
this.$router.push('/')
|
||||||
|
}
|
||||||
|
// #endregion
|
||||||
|
// #region watches
|
||||||
|
// #endregion
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss"></style>
|
||||||
@@ -15,7 +15,7 @@ export default async () => {
|
|||||||
loginUrl: '/',
|
loginUrl: '/',
|
||||||
jwt: {
|
jwt: {
|
||||||
useCookie: false,
|
useCookie: false,
|
||||||
accessTokenKey: 'acc-token',
|
accessTokenKey: 'sample-fo-token',
|
||||||
refreshTokenKey: 'ref-token',
|
refreshTokenKey: 'ref-token',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -41,6 +41,7 @@ export default async () => {
|
|||||||
materialDesignIcons: true,
|
materialDesignIcons: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
css: ['~/assets/global.scss'],
|
||||||
head: {
|
head: {
|
||||||
titleTemplate: 'U.STRA Node Framework Sample - FO',
|
titleTemplate: 'U.STRA Node Framework Sample - FO',
|
||||||
title: '',
|
title: '',
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ustra-sample/cmm": "1.0.0",
|
"@ustra-sample/cmm": "1.0.0",
|
||||||
"@ustra/nuxt": "^2.0.19-stable",
|
"@ustra/nuxt": "^2.0.23-stable",
|
||||||
"@ustra/nuxt-buefy": "^2.0.19-stable",
|
"@ustra/nuxt-buefy": "^2.0.23-stable",
|
||||||
"animejs": "^3.2.1"
|
"animejs": "^3.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2460,10 +2460,10 @@
|
|||||||
"@typescript-eslint/types" "4.28.5"
|
"@typescript-eslint/types" "4.28.5"
|
||||||
eslint-visitor-keys "^2.0.0"
|
eslint-visitor-keys "^2.0.0"
|
||||||
|
|
||||||
"@ustra/core@^2.0.19-stable":
|
"@ustra/core@^2.0.23-stable":
|
||||||
version "2.0.19-stable"
|
version "2.0.23-stable"
|
||||||
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/core/-/core-2.0.19-stable.tgz#01f69e81d321bfed6bb58334e019c286d4d74213"
|
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/core/-/core-2.0.23-stable.tgz#91b9b07fa7d183e4fa0d57ddeb89e8d263ce6e12"
|
||||||
integrity sha512-ga0HbN9fjBc2IKFOnsF33BulvDglvIL7BXwlEo17z4xSg5iMvqVIVYjNC/3Jqh90QqXl7Nzy2qzbZuMV6wNoZQ==
|
integrity sha512-py9CoijFijBNwzhitC6gEL0e5H6fXf763EplV7JLOQlzMJ64kiuBudf55jUqnSm4M7HpVRv4SIDg/7rzg98ewQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
axios "0.21.1"
|
axios "0.21.1"
|
||||||
axios-jsonp-pro "1.1.8"
|
axios-jsonp-pro "1.1.8"
|
||||||
@@ -2487,59 +2487,59 @@
|
|||||||
winston "3.3.3"
|
winston "3.3.3"
|
||||||
winston-daily-rotate-file "4.5.2"
|
winston-daily-rotate-file "4.5.2"
|
||||||
|
|
||||||
"@ustra/data@^2.0.19-stable":
|
"@ustra/data@^2.0.23-stable":
|
||||||
version "2.0.19-stable"
|
version "2.0.23-stable"
|
||||||
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/data/-/data-2.0.19-stable.tgz#e42405336ab12d048b64b41abf0d453b638ead51"
|
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/data/-/data-2.0.23-stable.tgz#4cd4e4d6bee9056ba97748e5b402a8076a3c4d9e"
|
||||||
integrity sha512-t3J/m+mafF5ZqVPSwp9yaXjiWf8gLFdOrnVtr+ommZOhawtOdsg5SsdWHkgRRD37R2iqH5T3zdREtvsCStzCBA==
|
integrity sha512-GmYV61KyU/QQIi2f7pFfEWn2+3YjtZpfuiaZTe9rloAjNirh/FtwMTCkVdSVSHA4Cp/3yVp38r7PZ21L+qlUlA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ustra/core" "^2.0.19-stable"
|
"@ustra/core" "^2.0.23-stable"
|
||||||
|
|
||||||
"@ustra/nuxt-buefy@^2.0.19-stable":
|
"@ustra/nuxt-buefy@^2.0.23-stable":
|
||||||
version "2.0.19-stable"
|
version "2.0.23-stable"
|
||||||
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-buefy/-/nuxt-buefy-2.0.19-stable.tgz#f448cadbf2ea0e86d152dc974144b66d3dfbf08e"
|
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-buefy/-/nuxt-buefy-2.0.23-stable.tgz#61f9a18dfd7fd55902e7a6ed5e95e598bbbbbf6b"
|
||||||
integrity sha512-AmEIqK4NOSpyrnzrU9hwAmGRbe+IwShxX/Dfagd5Herbk5PxcD/N3btthAl1xGpEWxCqEsTzMKtKeaMcTu7vCA==
|
integrity sha512-Xynzs6sqYZsBqvE66YrUsesktb0tFSG0Pjijaty1LFYNg+bR2SMSj26+CzlRgLHX93lGeiLqSkEIPY+qfDhKZw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ustra/nuxt" "^2.0.19-stable"
|
"@ustra/nuxt" "^2.0.23-stable"
|
||||||
nuxt-buefy "^0.4.7"
|
nuxt-buefy "^0.4.7"
|
||||||
|
|
||||||
"@ustra/nuxt-dx-mng-bo@^2.0.19-stable":
|
"@ustra/nuxt-dx-mng-bo@^2.0.23-stable":
|
||||||
version "2.0.19-stable"
|
version "2.0.23-stable"
|
||||||
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-dx-mng-bo/-/nuxt-dx-mng-bo-2.0.19-stable.tgz#1d0c4e3442af32e3928fc53b0b2b73d694fb802d"
|
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-dx-mng-bo/-/nuxt-dx-mng-bo-2.0.23-stable.tgz#5816fa97de569e6f0b89552286b82e75f8a3f589"
|
||||||
integrity sha512-lCLhIH+nkGMv4TnprQIpneAEOME19/ZOxewFgJXE7K4RhIz+cVxEj8bIlf8nwOCt9IP9oiJFo6oWyWqdtmsFfA==
|
integrity sha512-+N4sebSUYqTqWP/tf3qO8BwQEj72hxbjUyqifTPAjxdygi2GehVr6OQ+gFYSCQ/FFg9iNIBR4SiN45qyGjkB6w==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ustra/nuxt-dx" "^2.0.19-stable"
|
"@ustra/nuxt-dx" "^2.0.23-stable"
|
||||||
"@ustra/nuxt-mng-bo" "^2.0.19-stable"
|
"@ustra/nuxt-mng-bo" "^2.0.23-stable"
|
||||||
|
|
||||||
"@ustra/nuxt-dx@^2.0.19-stable":
|
"@ustra/nuxt-dx@^2.0.23-stable":
|
||||||
version "2.0.19-stable"
|
version "2.0.23-stable"
|
||||||
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-dx/-/nuxt-dx-2.0.19-stable.tgz#1529258564bcd66f2671ae126e0deb68511be3cc"
|
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-dx/-/nuxt-dx-2.0.23-stable.tgz#ceb2de960f812ac56f0456e872e81be9897e8a35"
|
||||||
integrity sha512-7Px/c5pM367sEKIzx2RhXRJ+l+zmfHzkmXfrYzTHMYo/0EKlBMARL4ANiCgKfaM6lFFdnjyAiQUTiDlgOqKVFw==
|
integrity sha512-lFOvuBITKXyvwNmeN1BfofvQjWS7qIOYrvc8BClunugHUWkaq6bYp4GJ9PxBnIA4lKM80IFONKJ9nO+s7hxGAQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ustra/nuxt" "^2.0.19-stable"
|
"@ustra/nuxt" "^2.0.23-stable"
|
||||||
devextreme "20.1-stable"
|
devextreme "20.1-stable"
|
||||||
devextreme-cldr-data "^1.0.3"
|
devextreme-cldr-data "^1.0.3"
|
||||||
devextreme-vue "20.1-stable"
|
devextreme-vue "20.1-stable"
|
||||||
globalize "^1.6.0"
|
globalize "^1.6.0"
|
||||||
material-icons "^0.3.1"
|
material-icons "^0.3.1"
|
||||||
|
|
||||||
"@ustra/nuxt-mng-bo@^2.0.19-stable":
|
"@ustra/nuxt-mng-bo@^2.0.23-stable":
|
||||||
version "2.0.19-stable"
|
version "2.0.23-stable"
|
||||||
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-mng-bo/-/nuxt-mng-bo-2.0.19-stable.tgz#24ceeb2c0ac4b00376c4e9ad4243da81dbd8b175"
|
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-mng-bo/-/nuxt-mng-bo-2.0.23-stable.tgz#dceebb3d1e8b63d4041e1ad8abae8769f3ea4b33"
|
||||||
integrity sha512-yDz/fZe3gXtAYs/Mx/jJ39fmwKTsQPHZGJKxOW7A0tO22T1ktiSrqiASutbgZ7s4258t1lok2heNtvOhUrWU6Q==
|
integrity sha512-nyWjkrkkbkxXNABXL54VldnCGl6lIO6G6SRfP2Vzh2bn5X56rtl7slNHFmW3asZ20oQMTUgcFfdUIfzw3pJ0PQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ustra/nuxt-mng" "^2.0.19-stable"
|
"@ustra/nuxt-mng" "^2.0.23-stable"
|
||||||
|
|
||||||
"@ustra/nuxt-mng@^2.0.19-stable":
|
"@ustra/nuxt-mng@^2.0.23-stable":
|
||||||
version "2.0.19-stable"
|
version "2.0.23-stable"
|
||||||
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-mng/-/nuxt-mng-2.0.19-stable.tgz#39ddf1c3a2a4886cec1887203ad90ac335591913"
|
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt-mng/-/nuxt-mng-2.0.23-stable.tgz#93bf5490ee92d9addc06989bffb3142cf681bfc3"
|
||||||
integrity sha512-XkszBlMyytMs30I38d3qyGuJEhWR0z2iD8nWVrUgiy4Tu1EmeEJlrxnz8Q2mOVJzecNTr5uY6vk7H2uXgepIbw==
|
integrity sha512-YdbbtoUbO1Vbw3P1ERh3L2Gqecb1fsOZFELQYgfgE3aXL8w1+LKRH2TylaRvcV3BkXlzqa/zPysIxCng6zeZMA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ustra/nuxt" "^2.0.19-stable"
|
"@ustra/nuxt" "^2.0.23-stable"
|
||||||
|
|
||||||
"@ustra/nuxt@^2.0.19-stable":
|
"@ustra/nuxt@^2.0.23-stable":
|
||||||
version "2.0.19-stable"
|
version "2.0.23-stable"
|
||||||
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt/-/nuxt-2.0.19-stable.tgz#b96d9a5f26492818ad0f5a3ecb858df605064573"
|
resolved "https://repo.gsitm.com/repository/npm-private/@ustra/nuxt/-/nuxt-2.0.23-stable.tgz#94422cdb52be62ef851fd13300e3b5038a3d5d97"
|
||||||
integrity sha512-doR0+hDIobDZCaK8/lcjxjSBpBmSbYbHak/Zl14gU15SU2oOYkcXZPUSdc2p4TOf3qwq19KfPnOP7cyrn/vDEw==
|
integrity sha512-ZhS/Jk3Ul2pmnjUALxtpukKjKlCQVVO3w0QkbJNmCGs22dR/eyRtWhYoRSLRu8V/5i+dae9pS8dD77yVNIgMIg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@nuxt/typescript-runtime" "0.4.10"
|
"@nuxt/typescript-runtime" "0.4.10"
|
||||||
"@nuxtjs/axios" "5.13.1"
|
"@nuxtjs/axios" "5.13.1"
|
||||||
@@ -2547,8 +2547,8 @@
|
|||||||
"@nuxtjs/proxy" "2.1.0"
|
"@nuxtjs/proxy" "2.1.0"
|
||||||
"@nuxtjs/redirect-module" "0.3.1"
|
"@nuxtjs/redirect-module" "0.3.1"
|
||||||
"@nuxtjs/router" "1.6.1"
|
"@nuxtjs/router" "1.6.1"
|
||||||
"@ustra/core" "^2.0.19-stable"
|
"@ustra/core" "^2.0.23-stable"
|
||||||
"@ustra/data" "^2.0.19-stable"
|
"@ustra/data" "^2.0.23-stable"
|
||||||
add "2.0.6"
|
add "2.0.6"
|
||||||
bluebird "3.7.2"
|
bluebird "3.7.2"
|
||||||
body-parser "1.19.0"
|
body-parser "1.19.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user