-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add double token support for seata netty communication authe…
…ntication
- Loading branch information
1 parent
679f86e
commit 32009a8
Showing
33 changed files
with
1,156 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
core/src/main/java/org/apache/seata/core/auth/AuthResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.seata.core.auth; | ||
|
||
import org.apache.seata.core.protocol.ResultCode; | ||
|
||
public class AuthResult { | ||
private ResultCode resultCode; | ||
|
||
private String accessToken; | ||
|
||
private String refreshToken; | ||
|
||
public AuthResult() { | ||
} | ||
|
||
public AuthResult(AuthResultBuilder builder) { | ||
this.resultCode = builder.getResultCode(); | ||
this.accessToken = builder.getAccessToken(); | ||
this.refreshToken = builder.getRefreshToken(); | ||
} | ||
|
||
public ResultCode getResultCode() { | ||
return resultCode; | ||
} | ||
|
||
public void setResultCode(ResultCode resultCode) { | ||
this.resultCode = resultCode; | ||
} | ||
|
||
public String getAccessToken() { | ||
return accessToken; | ||
} | ||
|
||
public void setAccessToken(String accessToken) { | ||
this.accessToken = accessToken; | ||
} | ||
|
||
public String getRefreshToken() { | ||
return refreshToken; | ||
} | ||
|
||
public void setRefreshToken(String refreshToken) { | ||
this.refreshToken = refreshToken; | ||
} | ||
|
||
} |
60 changes: 60 additions & 0 deletions
60
core/src/main/java/org/apache/seata/core/auth/AuthResultBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.seata.core.auth; | ||
|
||
import org.apache.seata.core.protocol.ResultCode; | ||
|
||
public class AuthResultBuilder { | ||
private ResultCode resultCode; | ||
private String accessToken; | ||
private String refreshToken; | ||
|
||
public ResultCode getResultCode() { | ||
return resultCode; | ||
} | ||
|
||
public String getAccessToken() { | ||
return accessToken; | ||
} | ||
|
||
public String getRefreshToken() { | ||
return refreshToken; | ||
} | ||
|
||
// 设置 resultCode | ||
public AuthResultBuilder setResultCode(ResultCode resultCode) { | ||
this.resultCode = resultCode; | ||
return this; | ||
} | ||
|
||
// 设置 accessToken | ||
public AuthResultBuilder setAccessToken(String accessToken) { | ||
this.accessToken = accessToken; | ||
return this; | ||
} | ||
|
||
// 设置 refreshToken | ||
public AuthResultBuilder setRefreshToken(String refreshToken) { | ||
this.refreshToken = refreshToken; | ||
return this; | ||
} | ||
|
||
// 构建最终的 AuthResult 对象 | ||
public AuthResult build() { | ||
return new AuthResult(this); | ||
} | ||
} |
Oops, something went wrong.