Skip to content

Commit

Permalink
Move authz package into identity
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Perkins <[email protected]>
  • Loading branch information
cwperks committed Sep 27, 2022
1 parent 7182afb commit 2bf5401
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.authz;
package org.opensearch.identity.authz;

import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.authz;
package org.opensearch.identity.authz;

import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
Expand All @@ -20,28 +20,28 @@
* @opensearch.experimental
*/
public class AuthorizationResponse extends TransportResponse {
private String response;
private String message;

private AuthorizationStatus authStatus;

public AuthorizationResponse(String response, AuthorizationStatus authStatus) {
this.response = response;
public AuthorizationResponse(String message, AuthorizationStatus authStatus) {
this.message = message;
this.authStatus = authStatus;
}

public AuthorizationResponse(StreamInput in) throws IOException {
response = in.readString();
message = in.readString();
authStatus = in.readEnum(AuthorizationStatus.class);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(response);
out.writeString(message);
out.writeEnum(authStatus);
}

public String getResponse() {
return response;
public String getMessage() {
return message;
}

public AuthorizationStatus getAuthStatus() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.authz;
package org.opensearch.identity.authz;

/**
* Status code for an AuthorizationResponse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* GitHub history for details.
*/

package org.opensearch.authz;
package org.opensearch.identity.authz;

import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -71,6 +71,7 @@ public static CheckableParameter readParameterFromStream(StreamInput in) throws
String key = in.readString();
String className = in.readString();
Object value = in.readGenericValue();
// Potential performance improvement for Class.forName(...) - https://stackoverflow.com/q/18231991/533057
return new CheckableParameter(key, value, Class.forName(className));
}

Expand All @@ -82,6 +83,6 @@ public static void writeParameterToStream(CheckableParameter param, StreamOutput

@Override
public String toString() {
return "CheckableParameter{key=" + key + ", value=" + value + "}";
return "CheckableParameter{key=" + key + ", value=" + value + ", type=" + type + "}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.authz;
package org.opensearch.identity.authz;

import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
*
* @opensearch.experimental
*/
package org.opensearch.authz;
package org.opensearch.identity.authz;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.authz;
package org.opensearch.identity.authz;

import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.StreamInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* compatible open source license.
*/

package org.opensearch.authz;
package org.opensearch.identity.authz;

import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.io.stream.BytesStreamInput;
Expand Down

0 comments on commit 2bf5401

Please sign in to comment.