mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 20:50:14 +08:00
Maxkey v1.0 GA
Maxkey v1.0 GA
This commit is contained in:
@@ -2,12 +2,12 @@ package org.maxkey.client.oauth.builder.api;
|
||||
|
||||
import org.maxkey.client.oauth.model.Token;
|
||||
|
||||
public class ConnsecApi10a extends DefaultApi10a
|
||||
public class MaxkeyApi10a extends DefaultApi10a
|
||||
{
|
||||
private static final String DEFAULT_WEB_URL = "http://sso.maxkey.org/maxkey";
|
||||
private static final String AUTHORIZATION_URL = DEFAULT_WEB_URL+"/oauth/v10a/authz?oauth_token=%s";
|
||||
|
||||
public ConnsecApi10a() {
|
||||
public MaxkeyApi10a() {
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.maxkey.client.oauth.model.OAuthConfig;
|
||||
import org.maxkey.client.utils.HttpEncoder;
|
||||
import org.maxkey.client.utils.Preconditions;
|
||||
|
||||
public class ConnsecApi20 extends DefaultApi20 {
|
||||
public class MaxkeyApi20 extends DefaultApi20 {
|
||||
//approval_prompt:force or auto
|
||||
private static final String DEFAULT_WEB_URL = "http://sso.maxkey.org/maxkey";
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ConnsecApi20 extends DefaultApi20 {
|
||||
|
||||
private static final String SCOPED_AUTHORIZE_URL = String.format("%s&scope=%%s", AUTHORIZATION_URL);
|
||||
|
||||
public ConnsecApi20() {
|
||||
public MaxkeyApi20() {
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import org.maxkey.client.oauth.model.OAuthConfig;
|
||||
/**
|
||||
* OAuth 2.0 api.
|
||||
*/
|
||||
public class ConnsecPasswordApi20 extends DefaultApi20 {
|
||||
public class MaxkeyPasswordApi20 extends DefaultApi20 {
|
||||
|
||||
private String accessTokenUrl;
|
||||
private String grantType = "password";
|
||||
@@ -19,7 +19,7 @@ public class ConnsecPasswordApi20 extends DefaultApi20 {
|
||||
|
||||
private static final String AUTHORIZE_PARAM = "&client_id=%s&client_secret=%s&username=%s&password=%s";
|
||||
|
||||
public ConnsecPasswordApi20(String accessTokenUrl) {
|
||||
public MaxkeyPasswordApi20(String accessTokenUrl) {
|
||||
super();
|
||||
this.accessTokenUrl = accessTokenUrl;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class OAuth10aServiceImpl implements OAuthService
|
||||
*/
|
||||
public OAuth10aServiceImpl(String clientId, String clientSecret,String redirectUri)
|
||||
{
|
||||
this.api = new ConnsecApi10a();
|
||||
this.api = new MaxkeyApi10a();
|
||||
this.config =new OAuthConfig(clientId,clientSecret,redirectUri);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class OAuth20ServiceImpl implements OAuthService
|
||||
*/
|
||||
public OAuth20ServiceImpl(String clientId, String clientSecret,String redirectUri)
|
||||
{
|
||||
this.api=new ConnsecApi20();
|
||||
this.api=new MaxkeyApi20();
|
||||
this.config =new OAuthConfig(clientId,clientSecret,redirectUri);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.maxkey.client.oauth.oauth;
|
||||
import org.maxkey.client.http.HttpVerb;
|
||||
import org.maxkey.client.http.Response;
|
||||
import org.maxkey.client.oauth.builder.ServiceBuilder;
|
||||
import org.maxkey.client.oauth.builder.api.ConnsecPasswordApi20;
|
||||
import org.maxkey.client.oauth.builder.api.MaxkeyPasswordApi20;
|
||||
import org.maxkey.client.oauth.model.OAuthConfig;
|
||||
import org.maxkey.client.oauth.model.OAuthRequest;
|
||||
import org.maxkey.client.oauth.model.Token;
|
||||
@@ -16,13 +16,13 @@ public class OAuthPasswordService {
|
||||
|
||||
private OAuthConfig config;
|
||||
|
||||
private ConnsecPasswordApi20 passwordApi20;
|
||||
private MaxkeyPasswordApi20 passwordApi20;
|
||||
|
||||
public OAuthPasswordService() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OAuthPasswordService(OAuthConfig config,ConnsecPasswordApi20 passwordApi20) {
|
||||
public OAuthPasswordService(OAuthConfig config,MaxkeyPasswordApi20 passwordApi20) {
|
||||
super();
|
||||
this.passwordApi20=passwordApi20;
|
||||
this.config = config;
|
||||
@@ -59,11 +59,11 @@ public class OAuthPasswordService {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public ConnsecPasswordApi20 getPasswordApi20() {
|
||||
public MaxkeyPasswordApi20 getPasswordApi20() {
|
||||
return passwordApi20;
|
||||
}
|
||||
|
||||
public void setPasswordApi20(ConnsecPasswordApi20 passwordApi20) {
|
||||
public void setPasswordApi20(MaxkeyPasswordApi20 passwordApi20) {
|
||||
this.passwordApi20 = passwordApi20;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.maxkey.client.oauth.OAuthClient;
|
||||
import org.maxkey.client.oauth.builder.ServiceBuilder;
|
||||
import org.maxkey.client.oauth.builder.api.ConnsecApi20;
|
||||
import org.maxkey.client.oauth.builder.api.MaxkeyApi20;
|
||||
import org.maxkey.client.oauth.domain.UserInfo;
|
||||
import org.maxkey.client.oauth.model.Token;
|
||||
import org.maxkey.client.oauth.model.Verifier;
|
||||
@@ -88,7 +88,7 @@ public class AuthenticationFilter implements Filter {
|
||||
log.debug("enable : "+enable);
|
||||
|
||||
service = new ServiceBuilder()
|
||||
.provider(ConnsecApi20.class)
|
||||
.provider(MaxkeyApi20.class)
|
||||
.apiKey(this.clientId)
|
||||
.apiSecret(this.clientSecret)
|
||||
.callback(this.callBackUri)
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.connsec.client.oauth.test;
|
||||
import java.util.*;
|
||||
|
||||
import org.maxkey.client.oauth.builder.ServiceBuilder;
|
||||
import org.maxkey.client.oauth.builder.api.ConnsecApi10a;
|
||||
import org.maxkey.client.oauth.builder.api.MaxkeyApi10a;
|
||||
import org.maxkey.client.oauth.model.Token;
|
||||
import org.maxkey.client.oauth.oauth.OAuthService;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class Connsec10aExample
|
||||
public static void main(String[] args)
|
||||
{
|
||||
OAuthService service = new ServiceBuilder()
|
||||
.provider(ConnsecApi10a.class)
|
||||
.provider(MaxkeyApi10a.class)
|
||||
.apiKey("tonr-consumer-key")
|
||||
.apiSecret("SHHHHH!!!!!!!!!!")
|
||||
.callback(PROTECTED_RESOURCE_URL)
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.*;
|
||||
import org.maxkey.client.http.HttpVerb;
|
||||
import org.maxkey.client.http.Response;
|
||||
import org.maxkey.client.oauth.builder.ServiceBuilder;
|
||||
import org.maxkey.client.oauth.builder.api.ConnsecApi10a;
|
||||
import org.maxkey.client.oauth.builder.api.MaxkeyApi10a;
|
||||
import org.maxkey.client.oauth.model.OAuthRequest;
|
||||
import org.maxkey.client.oauth.model.Token;
|
||||
import org.maxkey.client.oauth.model.Verifier;
|
||||
@@ -19,7 +19,7 @@ public class Connsec10aVerifierExample
|
||||
public static void main(String[] args)
|
||||
{
|
||||
OAuthService service = new ServiceBuilder()
|
||||
.provider(ConnsecApi10a.class)
|
||||
.provider(MaxkeyApi10a.class)
|
||||
.apiKey("tonr-consumer-key")
|
||||
.apiSecret("SHHHHH!!!!!!!!!!")
|
||||
.callback(PROTECTED_RESOURCE_URL)
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.*;
|
||||
import org.maxkey.client.http.HttpVerb;
|
||||
import org.maxkey.client.http.Response;
|
||||
import org.maxkey.client.oauth.builder.ServiceBuilder;
|
||||
import org.maxkey.client.oauth.builder.api.ConnsecApi20;
|
||||
import org.maxkey.client.oauth.builder.api.MaxkeyApi20;
|
||||
import org.maxkey.client.oauth.model.OAuthRequest;
|
||||
import org.maxkey.client.oauth.model.Token;
|
||||
import org.maxkey.client.oauth.model.Verifier;
|
||||
@@ -23,7 +23,7 @@ public class Connsec20Example
|
||||
String apiKey = "your_api_key";
|
||||
String apiSecret = "your_api_secret";
|
||||
OAuthService service = new ServiceBuilder()
|
||||
.provider(ConnsecApi20.class)
|
||||
.provider(MaxkeyApi20.class)
|
||||
.apiKey(apiKey)
|
||||
.apiSecret(apiSecret)
|
||||
.callback("http://www.dajie.com/oauth/sina")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.connsec.client.oauth.test;
|
||||
|
||||
import org.maxkey.client.http.Response;
|
||||
import org.maxkey.client.oauth.builder.api.ConnsecPasswordApi20;
|
||||
import org.maxkey.client.oauth.builder.api.MaxkeyPasswordApi20;
|
||||
import org.maxkey.client.oauth.model.OAuthConfig;
|
||||
import org.maxkey.client.oauth.model.Token;
|
||||
import org.maxkey.client.oauth.oauth.OAuthPasswordService;
|
||||
@@ -23,7 +23,7 @@ public class ConnsecPasswordDemo {
|
||||
String approvalprompt = "auto";
|
||||
OAuthConfig oauthServiceConfig=new OAuthConfig(clientId,clientSerect,callback);
|
||||
|
||||
ConnsecPasswordApi20 ConnsecPasswordApi20=new ConnsecPasswordApi20(accessTokenUrl);
|
||||
MaxkeyPasswordApi20 ConnsecPasswordApi20=new MaxkeyPasswordApi20(accessTokenUrl);
|
||||
|
||||
OAuthPasswordService oAuthPasswordService=new OAuthPasswordService(oauthServiceConfig,ConnsecPasswordApi20);
|
||||
Token accessToken = null;
|
||||
|
||||
Reference in New Issue
Block a user