建立測試用的專案
測試用的專案主要目的是呼叫前面 [JAVA] 撰寫驗證伺服器 #1寫的認證IDP專案
一、克隆專案
上面的選單[Team]->[Remote]->[Clone...]
URL貼上網址 https://oidcrs.tanet.edu.tw/shengche/cncauthdemo
帳密是OIDC的帳密,按[Next]選擇分枝[master*]按完成
二、引入你的專案
開啟 pom.xml
到dependenciey 按滑鼠右鍵 選擇[Insert Code]
選擇[Dependency...]
在Query欄位打入你的專案名稱,會出現你的專案,點開後選擇版本即可,按[Add]完成
這時 pom.xml 會多一個你的dependency,目前看起來像這樣
<dependencies> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-dbcp2</artifactId> <version>2.1.1</version> </dependency> <dependency> <groupId>${project.groupId}</groupId> <artifactId>cnclibs</artifactId> <version>0.0.3</version> </dependency> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>rest</groupId> <artifactId>IDP001</artifactId> <version>1.0</version> </dependency> </dependencies>
三、測試
在netbean中測試
到你的專案按滑鼠右鍵選[properties],左邊目錄選擇[Run]右邊的 Arguments打入 -u user -p pass
直接執行netbean的Run
在命令列中下指令
build 你的專案,找到你的專案目錄
一般而言會在家目錄中
你的家目錄中/NetBeansProjects/cncauthdemo/target/
$ java -jar cncauthdemo-0.0.1.jar -u user -p passwd
執行結果範例
user:passwd
Load Service
31 八月 2017 13:34:24,584 authentication.AuthenticationService authentication.AuthenticationService.getInstance(AuthenticationService.java:39)
Service Loading...
31 八月 2017 13:34:24,593 authentication.AuthenticationService authentication.AuthenticationService.doAuthenticate(AuthenticationService.java:49)
Load providers
31 八月 2017 13:34:24,596 authentication.AuthenticationService authentication.AuthenticationService.doAuthenticate(AuthenticationService.java:51)
Check providers
31 八月 2017 13:34:24,601 authentication.myAuth authentication.myAuth.doAuthenticate(myAuth.java:31)
username:user
password:passwd
31 八月 2017 13:34:24,601 authentication.myAuth authentication.myAuth.doAuthenticate(myAuth.java:35)
AXER Implementation
models.edumodel.ExchangeDataModel@27c6e487[username=<null>,fullname=AXER,email=axeredu@edu.tw,schoolid=<null>,titles=<null>,classinfo=<null>,educloudroles=<null>,guid=<null>,pid=<null>,openid=<null>]
31 八月 2017 13:34:24,662 authentication.myAuth authentication.myAuth.doAuthenticate(myAuth.java:38)
models.edumodel.ExchangeDataModel@27c6e487[username=<null>,fullname=AXER,email=axeredu@edu.tw,schoolid=<null>,titles=<null>,classinfo=<null>,educloudroles=<null>,guid=<null>,pid=<null>,openid=<null>]
Load Service
31 八月 2017 13:34:24,584 authentication.AuthenticationService authentication.AuthenticationService.getInstance(AuthenticationService.java:39)
Service Loading...
31 八月 2017 13:34:24,593 authentication.AuthenticationService authentication.AuthenticationService.doAuthenticate(AuthenticationService.java:49)
Load providers
31 八月 2017 13:34:24,596 authentication.AuthenticationService authentication.AuthenticationService.doAuthenticate(AuthenticationService.java:51)
Check providers
31 八月 2017 13:34:24,601 authentication.myAuth authentication.myAuth.doAuthenticate(myAuth.java:31)
username:user
password:passwd
31 八月 2017 13:34:24,601 authentication.myAuth authentication.myAuth.doAuthenticate(myAuth.java:35)
AXER Implementation
models.edumodel.ExchangeDataModel@27c6e487[username=<null>,fullname=AXER,email=axeredu@edu.tw,schoolid=<null>,titles=<null>,classinfo=<null>,educloudroles=<null>,guid=<null>,pid=<null>,openid=<null>]
31 八月 2017 13:34:24,662 authentication.myAuth authentication.myAuth.doAuthenticate(myAuth.java:38)
models.edumodel.ExchangeDataModel@27c6e487[username=<null>,fullname=AXER,email=axeredu@edu.tw,schoolid=<null>,titles=<null>,classinfo=<null>,educloudroles=<null>,guid=<null>,pid=<null>,openid=<null>]