| Authenticator | Line # 13 | 0 | 0 | - |
-1.0
|
| Authenticator.Result | Line # 17 | 13 | 8 | 100% |
1.0
|
| Authenticator.Result.Status | Line # 68 | 4 | 3 | 71.4% |
0.71428573
|
| Authenticator.Result.Status.Constants | Line # 74 | 0 | 0 | - |
-1.0
|
| Authenticator.Result.NoAttempt | Line # 107 | 1 | 1 | 100% |
1.0
|
| Authenticator.Result.Error | Line # 115 | 1 | 1 | 100% |
1.0
|
| Authenticator.Result.Failure | Line # 123 | 1 | 1 | 100% |
1.0
|
| Authenticator.Result.Success | Line # 131 | 1 | 1 | 100% |
1.0
|
| (30) | |||
| Result | |||
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadRequestUrl
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadRequestUrl
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBlankAppId
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBlankAppId
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadCertificate
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadCertificate
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testUnknownApp
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testUnknownApp
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testPrincipalLoginDenied
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testPrincipalLoginDenied
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadProtocolVersion
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadProtocolVersion
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testMissingMagicNumber
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testMissingMagicNumber
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testMissingSecretKey
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testMissingSecretKey
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadXForwardIp
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadXForwardIp
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadRequestIp
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testBadRequestIp
|
1 PASS | |
|
0.45945945
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testPrincipalNotFound
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testPrincipalNotFound
|
1 PASS | |
|
0.43243244
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testKnownAppProtocolVersion0
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testKnownAppProtocolVersion0
|
1 PASS | |
|
0.4054054
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadPublicKey
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadPublicKey
|
1 PASS | |
|
0.4054054
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadSecretKey
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadSecretKey
|
1 PASS | |
|
0.4054054
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadCertificate
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadCertificate
|
1 PASS | |
|
0.4054054
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testKnownAppProtocolVersion1
com.atlassian.security.auth.trustedapps.filter.TestTrustedAppAuthenticatorImpl.testKnownAppProtocolVersion1
|
1 PASS | |
|
0.4054054
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadXForwardIp
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadXForwardIp
|
1 PASS | |
|
0.4054054
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testUnknownApp
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testUnknownApp
|
1 PASS | |
|
0.4054054
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadRequestIp
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadRequestIp
|
1 PASS | |
|
0.4054054
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadRequestUrl
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testBadRequestUrl
|
1 PASS | |
|
0.35135135
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testKnownAppProtocolVersion0
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testKnownAppProtocolVersion0
|
1 PASS | |
|
0.35135135
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testKnownAppProtocolVersion1
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testKnownAppProtocolVersion1
|
1 PASS | |
|
0.3243243
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testNoTrustedAppAttempt
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilterAuthenticate.testNoTrustedAppAttempt
|
1 PASS | |
|
0.27027026
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testSessionInvalidateCalledForNonCertURLWhenExceptionThrown
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testSessionInvalidateCalledForNonCertURLWhenExceptionThrown
|
1 PASS | |
|
0.27027026
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testAuthenticateCalledForNonCertURL
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testAuthenticateCalledForNonCertURL
|
1 PASS | |
|
0.10810811
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testAuthenticatorResultCtor
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testAuthenticatorResultCtor
|
1 PASS | |
|
0.054054055
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testResultStatusError
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testResultStatusError
|
1 PASS | |
|
0.054054055
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testResultStatusFailed
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testResultStatusFailed
|
1 PASS | |
|
0.054054055
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testResultStatusNoAttempt
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testResultStatusNoAttempt
|
1 PASS | |
|
0.054054055
|
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testResultStatusSuccess
com.atlassian.security.auth.trustedapps.filter.TestTrustedApplicationsFilter.testResultStatusSuccess
|
1 PASS | |
| 1 | package com.atlassian.security.auth.trustedapps.filter; | |
| 2 | ||
| 3 | import com.atlassian.security.auth.trustedapps.TransportErrorMessage; | |
| 4 | import com.atlassian.security.auth.trustedapps.Null; | |
| 5 | ||
| 6 | import javax.servlet.http.HttpServletRequest; | |
| 7 | import javax.servlet.http.HttpServletResponse; | |
| 8 | import java.security.Principal; | |
| 9 | ||
| 10 | /** | |
| 11 | * Authenticate a TrustedApplication request | |
| 12 | */ | |
| 13 | public interface Authenticator | |
| 14 | { | |
| 15 | Result authenticate(HttpServletRequest request, HttpServletResponse response); | |
| 16 | ||
| 17 | static class Result | |
| 18 | { | |
| 19 | private final Result.Status status; | |
| 20 | private final TransportErrorMessage message; | |
| 21 | private final Principal user; | |
| 22 | ||
| 23 | 3 |
Result(Result.Status status) |
| 24 | { | |
| 25 | 3 | this(status, null, null); |
| 26 | } | |
| 27 | ||
| 28 | 18 |
Result(Result.Status status, TransportErrorMessage message) |
| 29 | { | |
| 30 | 18 | this(status, message, null); |
| 31 | ||
| 32 | 18 | Null.not("message", message); |
| 33 | } | |
| 34 | ||
| 35 | 4 |
Result(Result.Status status, Principal principal) |
| 36 | { | |
| 37 | 4 | this(status, null, principal); |
| 38 | ||
| 39 | 4 | Null.not("principal", principal); |
| 40 | } | |
| 41 | ||
| 42 | 26 |
Result(Result.Status status, TransportErrorMessage message, Principal user) |
| 43 | { | |
| 44 | 26 | if (status == null) |
| 45 | { | |
| 46 | 1 | throw new IllegalArgumentException("status"); |
| 47 | } | |
| 48 | 25 | this.status = status; |
| 49 | 25 | this.message = message; |
| 50 | 25 | this.user = user; |
| 51 | } | |
| 52 | ||
| 53 | 33 |
public Result.Status getStatus() |
| 54 | { | |
| 55 | 33 | return status; |
| 56 | } | |
| 57 | ||
| 58 | 33 |
public String getMessage() |
| 59 | { | |
| 60 | 33 | return message.toString(); |
| 61 | } | |
| 62 | ||
| 63 | 12 |
public Principal getUser() |
| 64 | { | |
| 65 | 12 | return user; |
| 66 | } | |
| 67 | ||
| 68 | static final class Status | |
| 69 | { | |
| 70 | /** | |
| 71 | * Necessary to declare these as int constants as javac is too dumb to realise that a final member of a | |
| 72 | * final class's static constants is a constant | |
| 73 | */ | |
| 74 | static final class Constants | |
| 75 | { | |
| 76 | static final int SUCCESS = 0; | |
| 77 | static final int FAILED = 1; | |
| 78 | static final int ERROR = 2; | |
| 79 | static final int NO_ATTEMPT = 3; | |
| 80 | } | |
| 81 | ||
| 82 | static final Result.Status SUCCESS = new Result.Status(Result.Status.Constants.SUCCESS, "success"); | |
| 83 | static final Result.Status FAILED = new Result.Status(Result.Status.Constants.FAILED, "failed"); | |
| 84 | static final Result.Status ERROR = new Result.Status(Result.Status.Constants.ERROR, "error"); | |
| 85 | static final Result.Status NO_ATTEMPT = new Result.Status(Result.Status.Constants.NO_ATTEMPT, "no attempt"); | |
| 86 | ||
| 87 | private final int ordinal; | |
| 88 | private final String name; | |
| 89 | ||
| 90 | 4 |
private Status(int ordinal, String name) |
| 91 | { | |
| 92 | 4 | this.ordinal = ordinal; |
| 93 | 4 | this.name = name; |
| 94 | } | |
| 95 | ||
| 96 | 0 |
int getOrdinal() |
| 97 | { | |
| 98 | 0 | return ordinal; |
| 99 | } | |
| 100 | ||
| 101 | 4 |
public String toString() |
| 102 | { | |
| 103 | 4 | return name; |
| 104 | } | |
| 105 | } | |
| 106 | ||
| 107 | public static final class NoAttempt extends Result | |
| 108 | { | |
| 109 | 1 |
NoAttempt() |
| 110 | { | |
| 111 | 1 | super(Status.NO_ATTEMPT); |
| 112 | } | |
| 113 | } | |
| 114 | ||
| 115 | public static final class Error extends Result | |
| 116 | { | |
| 117 | 14 |
Error(TransportErrorMessage message) |
| 118 | { | |
| 119 | 14 | super(Status.ERROR, message); |
| 120 | } | |
| 121 | } | |
| 122 | ||
| 123 | public static final class Failure extends Result | |
| 124 | { | |
| 125 | 4 |
Failure(TransportErrorMessage message) |
| 126 | { | |
| 127 | 4 | super(Status.FAILED, message); |
| 128 | } | |
| 129 | } | |
| 130 | ||
| 131 | public static final class Success extends Result | |
| 132 | { | |
| 133 | 4 |
public Success(Principal principal) |
| 134 | { | |
| 135 | 4 | super(Status.SUCCESS, principal); |
| 136 | } | |
| 137 | } | |
| 138 | } | |
| 139 | } | |
|
||||||||||