-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from TAK-Product-Center/upstream/5.2-RELEASE-16
TAK Server 5.2-RELEASE-16
- Loading branch information
Showing
482 changed files
with
22,531 additions
and
2,919 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
Binary file not shown.
Binary file not shown.
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
421 changes: 421 additions & 0 deletions
421
src/federation-common/src/main/java/io/netty/handler/ssl/OpenSslServerContext.java
Large diffs are not rendered by default.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
src/federation-common/src/main/java/tak/server/federation/FederateTokenGroup.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,18 @@ | ||
package tak.server.federation; | ||
|
||
public class FederateTokenGroup extends FederateGroup { | ||
|
||
private String token; | ||
|
||
public FederateTokenGroup(FederateIdentity federateIdentity) { | ||
super(federateIdentity); | ||
} | ||
|
||
public String getToken() { | ||
return token; | ||
} | ||
|
||
public void setToken(String token) { | ||
this.token = token; | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
src/federation-common/src/main/java/tak/server/federation/TokenAuthCredential.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,40 @@ | ||
package tak.server.federation; | ||
|
||
import static io.grpc.Metadata.ASCII_STRING_MARSHALLER; | ||
|
||
import java.util.concurrent.Executor; | ||
|
||
import io.grpc.CallCredentials; | ||
import io.grpc.Metadata; | ||
import io.grpc.Status; | ||
|
||
public class TokenAuthCredential extends CallCredentials { | ||
public static final String BEARER_TYPE = "Bearer"; | ||
|
||
public static final Metadata.Key<String> AUTHORIZATION_METADATA_KEY = Metadata.Key.of("Authorization", | ||
ASCII_STRING_MARSHALLER); | ||
|
||
private final String token; | ||
|
||
public TokenAuthCredential(String token) { | ||
this.token = token; | ||
} | ||
|
||
@Override | ||
public void applyRequestMetadata(final RequestInfo requestInfo, final Executor executor, | ||
final MetadataApplier metadataApplier) { | ||
|
||
executor.execute(new Runnable() { | ||
@Override | ||
public void run() { | ||
try { | ||
Metadata headers = new Metadata(); | ||
headers.put(AUTHORIZATION_METADATA_KEY, String.format("%s %s", BEARER_TYPE, token)); | ||
metadataApplier.apply(headers); | ||
} catch (Throwable e) { | ||
metadataApplier.fail(Status.UNAUTHENTICATED.withCause(e)); | ||
} | ||
} | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.